Reduce unnecessary OOM from screen captures.

WebContents.getContentBitmapAsync was unnecessarily passing the bitmap
to java before compressing it and saving to disk.

Instead, changes the API so that the caller provides a directory in which to
grab screenshots, and then WebContents seemlessly creates a new temp
file, compresses to jpeg and saves to that directory, requiring 0 java heap
allocation. As part of this async screen capture, also get a public Uri
for exporting via ContentProvider because all clients do this anyway.
BUG=651348

Change-Id: I6be01348f225adfa370c6a5e08ebd57f15e8fe93
Reviewed-on: https://chromium-review.googlesource.com/935670
Reviewed-by: Bernhard Bauer <bauerb@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Commit-Queue: Yaron Friedman <yfriedman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550240}

CrOS-Libchrome-Original-Commit: 0dc3d91393d24fa0bff0fda43d7a67b4d3bae66a
2 files changed
tree: 4ff73f07cf80b730853e510683e01aff11f1c452
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/