Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1090)

Unified Diff: content/browser/frame_host/render_widget_host_view_child_frame.h

Issue 1635513003: Implement webview.captureVisibleRegion() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Save bug number to surface_utils.cc. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
};
« no previous file with comments | « content/browser/compositor/surface_utils.cc ('k') | content/browser/frame_host/render_widget_host_view_child_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698