| Index: content/browser/frame_host/render_widget_host_view_child_frame.h
|
| diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.h b/content/browser/frame_host/render_widget_host_view_child_frame.h
|
| index c77b216b229ced95bdb1745c45adcd44515e7205..817bc2e8f3e6fb481ccce66bd3588ca30fff8e98 100644
|
| --- a/content/browser/frame_host/render_widget_host_view_child_frame.h
|
| +++ b/content/browser/frame_host/render_widget_host_view_child_frame.h
|
| @@ -8,8 +8,10 @@
|
| #include <stddef.h>
|
| #include <stdint.h>
|
|
|
| +#include <deque>
|
| #include <vector>
|
|
|
| +#include "base/callback.h"
|
| #include "base/macros.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "build/build_config.h"
|
| @@ -58,6 +60,15 @@ class CONTENT_EXPORT RenderWidgetHostViewChildFrame
|
| frame_connector_ = frame_connector;
|
| }
|
|
|
| + // This functions registers single-use callbacks that want to be notified when
|
| + // the next frame is swapped. The callback is triggered by
|
| + // OnSwapCompositorFrame, which is the appropriate time to request pixel
|
| + // readback for the frame that is about to be drawn. Once called, the callback
|
| + // pointer is released.
|
| + // TODO(wjmaclean): We should consider making this available in other view
|
| + // types, such as RenderWidgetHostViewAura.
|
| + void RegisterFrameSwappedCallback(scoped_ptr<base::Closure> callback);
|
| +
|
| // RenderWidgetHostView implementation.
|
| void InitAsChild(gfx::NativeView parent_view) override;
|
| RenderWidgetHost* GetRenderWidgetHost() const override;
|
| @@ -175,6 +186,8 @@ class CONTENT_EXPORT RenderWidgetHostViewChildFrame
|
| // Clears current compositor surface, if one is in use.
|
| void ClearCompositorSurfaceIfNecessary();
|
|
|
| + void ProcessFrameSwappedCallbacks();
|
| +
|
| // The last scroll offset of the view.
|
| gfx::Vector2dF last_scroll_offset_;
|
|
|
| @@ -205,6 +218,16 @@ class CONTENT_EXPORT RenderWidgetHostViewChildFrame
|
| }
|
|
|
| private:
|
| + void SubmitSurfaceCopyRequest(const gfx::Rect& src_subrect,
|
| + const gfx::Size& dst_size,
|
| + const ReadbackRequestCallback& callback,
|
| + const SkColorType preferred_color_type);
|
| +
|
| + using FrameSwappedCallbackList = std::deque<scoped_ptr<base::Closure>>;
|
| + // Since frame-drawn callbacks are "fire once", we use std::deque to make
|
| + // it convenient to swap() when processing the list.
|
| + FrameSwappedCallbackList frame_swapped_callbacks_;
|
| +
|
| base::WeakPtrFactory<RenderWidgetHostViewChildFrame> weak_factory_;
|
| DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame);
|
| };
|
|
|