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

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: addressed the review comments. Created 6 years, 4 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
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ~ReadbackRequest();
69 float GetScale() { return scale_; }
70 SkColorType GetColorFormat() { return color_type_; }
71 const gfx::Rect GetCaptureRect() { return src_subrect_; }
72 const base::Callback<void(bool, const SkBitmap&)>& GetResultCallback() {
73 return result_callback_;
74 }
75
76 private:
77 ReadbackRequest();
78 float scale_;
79 SkColorType color_type_;
80 gfx::Rect src_subrect_;
81 base::Callback<void(bool, const SkBitmap&)> result_callback_;
82 };
83
61 // ----------------------------------------------------------------------------- 84 // -----------------------------------------------------------------------------
62 // See comments in render_widget_host_view.h about this class and its members. 85 // See comments in render_widget_host_view.h about this class and its members.
63 // ----------------------------------------------------------------------------- 86 // -----------------------------------------------------------------------------
64 class CONTENT_EXPORT RenderWidgetHostViewAndroid 87 class CONTENT_EXPORT RenderWidgetHostViewAndroid
65 : public RenderWidgetHostViewBase, 88 : public RenderWidgetHostViewBase,
66 public cc::DelegatedFrameResourceCollectionClient, 89 public cc::DelegatedFrameResourceCollectionClient,
67 public ImageTransportFactoryAndroidObserver, 90 public ImageTransportFactoryAndroidObserver,
68 public ui::GestureProviderClient, 91 public ui::GestureProviderClient,
69 public ui::WindowAndroidObserver, 92 public ui::WindowAndroidObserver,
70 public DelegatedFrameEvictorClient, 93 public DelegatedFrameEvictorClient,
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 void InternalSwapCompositorFrame(uint32 output_surface_id, 333 void InternalSwapCompositorFrame(uint32 output_surface_id,
311 scoped_ptr<cc::CompositorFrame> frame); 334 scoped_ptr<cc::CompositorFrame> frame);
312 335
313 bool Animate(base::TimeTicks frame_time); 336 bool Animate(base::TimeTicks frame_time);
314 337
315 void OnContentScrollingChange(); 338 void OnContentScrollingChange();
316 bool IsContentScrolling() const; 339 bool IsContentScrolling() const;
317 340
318 float GetDpiScale() const; 341 float GetDpiScale() const;
319 342
343 // Handles all unprocessed and pending readback requests.
344 void AbortPendingReadbackRequests();
345
320 // The model object. 346 // The model object.
321 RenderWidgetHostImpl* host_; 347 RenderWidgetHostImpl* host_;
322 348
323 // Used to track whether this render widget needs a BeginFrame. 349 // Used to track whether this render widget needs a BeginFrame.
324 bool needs_begin_frame_; 350 bool needs_begin_frame_;
325 351
326 bool is_showing_; 352 bool is_showing_;
327 353
328 // ContentViewCoreImpl is our interface to the view system. 354 // ContentViewCoreImpl is our interface to the view system.
329 ContentViewCoreImpl* content_view_core_; 355 ContentViewCoreImpl* content_view_core_;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 scoped_ptr<cc::CompositorFrame> output_frame); 412 scoped_ptr<cc::CompositorFrame> output_frame);
387 ~LastFrameInfo(); 413 ~LastFrameInfo();
388 uint32 output_surface_id; 414 uint32 output_surface_id;
389 scoped_ptr<cc::CompositorFrame> frame; 415 scoped_ptr<cc::CompositorFrame> frame;
390 }; 416 };
391 417
392 scoped_ptr<LastFrameInfo> last_frame_info_; 418 scoped_ptr<LastFrameInfo> last_frame_info_;
393 419
394 TextSurroundingSelectionCallback text_surrounding_selection_callback_; 420 TextSurroundingSelectionCallback text_surrounding_selection_callback_;
395 421
422 // List of readbackrequests waiting for arrival of a valid frame.
423 std::queue<ReadbackRequest> readbacks_waiting_for_frame_;
424
396 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); 425 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid);
397 }; 426 };
398 427
399 } // namespace content 428 } // namespace content
400 429
401 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ 430 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698