Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_impl.h |
| diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h |
| index 8c17eef9be6970a9fd9b47198fb2d10594983947..d5d360fb1962e5dc229f84e0f41617700ce3f598 100644 |
| --- a/content/browser/renderer_host/render_widget_host_impl.h |
| +++ b/content/browser/renderer_host/render_widget_host_impl.h |
| @@ -48,6 +48,7 @@ |
| #include "ui/events/gesture_detection/gesture_provider_config_helper.h" |
| #include "ui/events/latency_info.h" |
| #include "ui/gfx/native_widget_types.h" |
| +#include "ui/snapshot/snapshot.h" |
| struct FrameHostMsg_HittestData_Params; |
| struct ViewHostMsg_SelectionBounds_Params; |
| @@ -209,10 +210,12 @@ class CONTENT_EXPORT RenderWidgetHostImpl : public RenderWidgetHost, |
| void NotifyScreenInfoChanged(); |
| // Forces redraw in the renderer and when the update reaches the browser |
| - // grabs snapshot from the compositor. Returns PNG-encoded snapshot. |
| + // grabs snapshot from the compositor. Returns encoded snapshot. |
| using GetSnapshotFromBrowserCallback = |
| base::Callback<void(const unsigned char*, size_t)>; |
| - void GetSnapshotFromBrowser(const GetSnapshotFromBrowserCallback& callback); |
| + void GetSnapshotFromBrowser(const GetSnapshotFromBrowserCallback& callback, |
| + ui::SnapshotEncoding encoding, |
| + ui::SnapshotQuality quality); |
| const NativeWebKeyboardEvent* GetLastKeyboardEvent() const; |
| @@ -700,13 +703,13 @@ class CONTENT_EXPORT RenderWidgetHostImpl : public RenderWidgetHost, |
| void WindowSnapshotReachedScreen(int snapshot_id); |
| - void OnSnapshotDataReceived(int snapshot_id, |
| - const unsigned char* png, |
| + void OnSnapshotDataReceived(const GetSnapshotFromBrowserCallback& callback, |
| + const unsigned char* data, |
| size_t size); |
| void OnSnapshotDataReceivedAsync( |
| - int snapshot_id, |
| - scoped_refptr<base::RefCountedBytes> png_data); |
| + const GetSnapshotFromBrowserCallback& callback, |
| + scoped_refptr<base::RefCountedBytes> data); |
| // 1. Grants permissions to URL (if any) |
| // 2. Grants permissions to filenames |
| @@ -866,9 +869,22 @@ class CONTENT_EXPORT RenderWidgetHostImpl : public RenderWidgetHost, |
| RenderWidgetHostLatencyTracker latency_tracker_; |
| + struct PendingSnapshotParams { |
| + PendingSnapshotParams(const GetSnapshotFromBrowserCallback& callback, |
| + ui::SnapshotEncoding encoding, |
| + ui::SnapshotQuality quality); |
| + PendingSnapshotParams(const PendingSnapshotParams& params); |
| + ~PendingSnapshotParams(); |
| + |
| + GetSnapshotFromBrowserCallback callback; |
| + ui::SnapshotEncoding encoding; |
| + ui::SnapshotQuality quality; |
| + }; |
| + using PendingSnapshotParamsMap = std::map<int, PendingSnapshotParams>; |
| + |
| int next_browser_snapshot_id_; |
| - using PendingSnapshotMap = std::map<int, GetSnapshotFromBrowserCallback>; |
| - PendingSnapshotMap pending_browser_snapshots_; |
| + PendingSnapshotParamsMap pending_browser_snapshot_params_; |
| + int pending_browser_snapshots_; |
|
pfeldman
2017/01/03 18:42:33
not sure why you need it now.
Eric Seckler
2017/01/03 19:18:09
Currently, OnSnapshotDataReceived can't remove fro
|
| // Indicates whether a RenderFramehost has ownership, in which case this |
| // object does not self destroy. |