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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_
7 7
8 #include <map> 8 #include <map>
9 #include <queue> 9 #include <queue>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 namespace content { 53 namespace content {
54 class ContentViewCoreImpl; 54 class ContentViewCoreImpl;
55 class OverscrollGlow; 55 class OverscrollGlow;
56 class RenderWidgetHost; 56 class RenderWidgetHost;
57 class RenderWidgetHostImpl; 57 class RenderWidgetHostImpl;
58 struct DidOverscrollParams; 58 struct DidOverscrollParams;
59 struct NativeWebKeyboardEvent; 59 struct NativeWebKeyboardEvent;
60 60
61 class ReadbackRequest {
62 public:
63 explicit ReadbackRequest(
64 float scale,
65 SkColorType color_type,
66 gfx::Rect src_subrect,
67 const base::Callback<void(bool, const SkBitmap&)>& result_callback)
68 : scale_(scale),
69 color_type_(color_type),
70 src_subrect_(src_subrect),
71 result_callback_(result_callback) {}
72 ~ReadbackRequest() {};
73 float GetScale() { return scale_; }
74 SkColorType GetColorFormat() { return color_type_; }
75 gfx::Rect GetCaptureRect() { return src_subrect_; }
no sievers 2014/07/28 17:07:06 nit: return a reference for the rect
76 const base::Callback<void(bool, const SkBitmap&)>& GetResultCallback() {
77 return result_callback_;
78 }
79
80 private:
81 ReadbackRequest() {};
82 float scale_;
83 SkColorType color_type_;
84 gfx::Rect src_subrect_;
85 base::Callback<void(bool, const SkBitmap&)> result_callback_;
86 };
87
61 // ----------------------------------------------------------------------------- 88 // -----------------------------------------------------------------------------
62 // See comments in render_widget_host_view.h about this class and its members. 89 // See comments in render_widget_host_view.h about this class and its members.
63 // ----------------------------------------------------------------------------- 90 // -----------------------------------------------------------------------------
64 class CONTENT_EXPORT RenderWidgetHostViewAndroid 91 class CONTENT_EXPORT RenderWidgetHostViewAndroid
65 : public RenderWidgetHostViewBase, 92 : public RenderWidgetHostViewBase,
66 public cc::DelegatedFrameResourceCollectionClient, 93 public cc::DelegatedFrameResourceCollectionClient,
67 public ImageTransportFactoryAndroidObserver, 94 public ImageTransportFactoryAndroidObserver,
68 public ui::GestureProviderClient, 95 public ui::GestureProviderClient,
69 public ui::WindowAndroidObserver, 96 public ui::WindowAndroidObserver,
70 public DelegatedFrameEvictorClient, 97 public DelegatedFrameEvictorClient,
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 void InternalSwapCompositorFrame(uint32 output_surface_id, 335 void InternalSwapCompositorFrame(uint32 output_surface_id,
309 scoped_ptr<cc::CompositorFrame> frame); 336 scoped_ptr<cc::CompositorFrame> frame);
310 337
311 bool Animate(base::TimeTicks frame_time); 338 bool Animate(base::TimeTicks frame_time);
312 339
313 void OnContentScrollingChange(); 340 void OnContentScrollingChange();
314 bool IsContentScrolling() const; 341 bool IsContentScrolling() const;
315 342
316 float GetDpiScale() const; 343 float GetDpiScale() const;
317 344
345 // Add the ReadbackRequest to the queue and wait for frame arraival.
no sievers 2014/07/28 17:07:06 not: typo in 'arraival'
346 void WaitForValidFrameArrival(const ReadbackRequest& readback_request);
no sievers 2014/07/28 17:07:06 nit: How about a more specific name? Something lik
347
348 // Handles all unprocessed and pending readback requests.
349 void ProcessPendingReadbackRequests();
350
318 // The model object. 351 // The model object.
319 RenderWidgetHostImpl* host_; 352 RenderWidgetHostImpl* host_;
320 353
321 // Used to track whether this render widget needs a BeginFrame. 354 // Used to track whether this render widget needs a BeginFrame.
322 bool needs_begin_frame_; 355 bool needs_begin_frame_;
323 356
324 bool is_showing_; 357 bool is_showing_;
325 358
326 // ContentViewCoreImpl is our interface to the view system. 359 // ContentViewCoreImpl is our interface to the view system.
327 ContentViewCoreImpl* content_view_core_; 360 ContentViewCoreImpl* content_view_core_;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 scoped_ptr<cc::CompositorFrame> output_frame); 421 scoped_ptr<cc::CompositorFrame> output_frame);
389 ~LastFrameInfo(); 422 ~LastFrameInfo();
390 uint32 output_surface_id; 423 uint32 output_surface_id;
391 scoped_ptr<cc::CompositorFrame> frame; 424 scoped_ptr<cc::CompositorFrame> frame;
392 }; 425 };
393 426
394 scoped_ptr<LastFrameInfo> last_frame_info_; 427 scoped_ptr<LastFrameInfo> last_frame_info_;
395 428
396 TextSurroundingSelectionCallback text_surrounding_selection_callback_; 429 TextSurroundingSelectionCallback text_surrounding_selection_callback_;
397 430
431 // List of readbackrequests waiting for arrival of a valid frame.
432 std::queue<ReadbackRequest> readbacks_waiting_for_frame_;
433
398 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); 434 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid);
399 }; 435 };
400 436
401 } // namespace content 437 } // namespace content
402 438
403 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ 439 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698