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

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.h

Issue 415773007: Android:Allow a read-back request to wait for a first frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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/renderer_host/render_widget_host_view_android.h
diff --git a/content/browser/renderer_host/render_widget_host_view_android.h b/content/browser/renderer_host/render_widget_host_view_android.h
index 0468278b063321d7d3d77d006eb4e85bae5f1d5d..52831f0c698370398ee6b9054f2a943b65664afa 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.h
+++ b/content/browser/renderer_host/render_widget_host_view_android.h
@@ -58,6 +58,33 @@ class RenderWidgetHostImpl;
struct DidOverscrollParams;
struct NativeWebKeyboardEvent;
+class ReadbackRequest {
+ public:
+ explicit ReadbackRequest(
+ float scale,
+ SkColorType color_type,
+ gfx::Rect src_subrect,
+ const base::Callback<void(bool, const SkBitmap&)>& result_callback)
+ : scale_(scale),
+ color_type_(color_type),
+ src_subrect_(src_subrect),
+ result_callback_(result_callback) {}
+ ~ReadbackRequest() {};
+ float GetScale() { return scale_; }
+ SkColorType GetColorFormat() { return color_type_; }
+ gfx::Rect GetCaptureRect() { return src_subrect_; }
no sievers 2014/07/28 17:07:06 nit: return a reference for the rect
+ const base::Callback<void(bool, const SkBitmap&)>& GetResultCallback() {
+ return result_callback_;
+ }
+
+ private:
+ ReadbackRequest() {};
+ float scale_;
+ SkColorType color_type_;
+ gfx::Rect src_subrect_;
+ base::Callback<void(bool, const SkBitmap&)> result_callback_;
+};
+
// -----------------------------------------------------------------------------
// See comments in render_widget_host_view.h about this class and its members.
// -----------------------------------------------------------------------------
@@ -315,6 +342,12 @@ class CONTENT_EXPORT RenderWidgetHostViewAndroid
float GetDpiScale() const;
+ // Add the ReadbackRequest to the queue and wait for frame arraival.
no sievers 2014/07/28 17:07:06 not: typo in 'arraival'
+ void WaitForValidFrameArrival(const ReadbackRequest& readback_request);
no sievers 2014/07/28 17:07:06 nit: How about a more specific name? Something lik
+
+ // Handles all unprocessed and pending readback requests.
+ void ProcessPendingReadbackRequests();
+
// The model object.
RenderWidgetHostImpl* host_;
@@ -395,6 +428,9 @@ class CONTENT_EXPORT RenderWidgetHostViewAndroid
TextSurroundingSelectionCallback text_surrounding_selection_callback_;
+ // List of readbackrequests waiting for arrival of a valid frame.
+ std::queue<ReadbackRequest> readbacks_waiting_for_frame_;
+
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid);
};

Powered by Google App Engine
This is Rietveld 408576698