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

Side by Side Diff: content/browser/renderer_host/delegated_frame_host.h

Issue 2773433003: Fix CompositorResizeLock to do something. (Closed)
Patch Set: resizelock: observer-rebase Created 3 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_DELEGATED_FRAME_HOST_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "cc/output/begin_frame_args.h" 13 #include "cc/output/begin_frame_args.h"
14 #include "cc/output/copy_output_result.h" 14 #include "cc/output/copy_output_result.h"
15 #include "cc/scheduler/begin_frame_source.h" 15 #include "cc/scheduler/begin_frame_source.h"
16 #include "cc/surfaces/compositor_frame_sink_support_client.h" 16 #include "cc/surfaces/compositor_frame_sink_support_client.h"
17 #include "content/browser/compositor/image_transport_factory.h" 17 #include "content/browser/compositor/image_transport_factory.h"
18 #include "content/browser/compositor/owned_mailbox.h" 18 #include "content/browser/compositor/owned_mailbox.h"
19 #include "content/browser/renderer_host/delegated_frame_evictor.h" 19 #include "content/browser/renderer_host/delegated_frame_evictor.h"
20 #include "content/browser/renderer_host/dip_util.h" 20 #include "content/browser/renderer_host/dip_util.h"
21 #include "content/browser/renderer_host/render_widget_host_impl.h" 21 #include "content/browser/renderer_host/render_widget_host_impl.h"
22 #include "content/browser/renderer_host/render_widget_host_view_base.h" 22 #include "content/browser/renderer_host/render_widget_host_view_base.h"
23 #include "content/common/content_export.h"
23 #include "content/public/browser/render_process_host.h" 24 #include "content/public/browser/render_process_host.h"
24 #include "ui/compositor/compositor.h" 25 #include "ui/compositor/compositor.h"
25 #include "ui/compositor/compositor_observer.h" 26 #include "ui/compositor/compositor_observer.h"
26 #include "ui/compositor/compositor_vsync_manager.h" 27 #include "ui/compositor/compositor_vsync_manager.h"
27 #include "ui/compositor/layer.h" 28 #include "ui/compositor/layer.h"
28 #include "ui/events/event.h" 29 #include "ui/events/event.h"
29 #include "ui/gfx/geometry/rect_conversions.h" 30 #include "ui/gfx/geometry/rect_conversions.h"
30 31
31 namespace base { 32 namespace base {
32 class TickClock; 33 class TickClock;
33 } 34 }
34 35
35 namespace cc { 36 namespace cc {
36 class CompositorFrameSinkSupport; 37 class CompositorFrameSinkSupport;
37 } 38 }
38 39
39 namespace media { 40 namespace media {
40 class VideoFrame; 41 class VideoFrame;
41 } 42 }
42 43
43 namespace display_compositor { 44 namespace display_compositor {
44 class ReadbackYUVInterface; 45 class ReadbackYUVInterface;
45 } 46 }
46 47
47 namespace content { 48 namespace content {
48 49
49 class DelegatedFrameHost; 50 class DelegatedFrameHost;
50 class RenderWidgetHostViewFrameSubscriber; 51 class RenderWidgetHostViewFrameSubscriber;
51 class ResizeLock; 52 class CompositorResizeLock;
52 53
53 // The DelegatedFrameHostClient is the interface from the DelegatedFrameHost, 54 // The DelegatedFrameHostClient is the interface from the DelegatedFrameHost,
54 // which manages delegated frames, and the ui::Compositor being used to 55 // which manages delegated frames, and the ui::Compositor being used to
55 // display them. 56 // display them.
56 class CONTENT_EXPORT DelegatedFrameHostClient { 57 class CONTENT_EXPORT DelegatedFrameHostClient {
57 public: 58 public:
58 virtual ~DelegatedFrameHostClient() {} 59 virtual ~DelegatedFrameHostClient() {}
59 60
60 virtual ui::Layer* DelegatedFrameHostGetLayer() const = 0; 61 virtual ui::Layer* DelegatedFrameHostGetLayer() const = 0;
61 virtual bool DelegatedFrameHostIsVisible() const = 0; 62 virtual bool DelegatedFrameHostIsVisible() const = 0;
62 63
63 // Returns the color that the resize gutters should be drawn with. Takes the 64 // Returns the color that the resize gutters should be drawn with. Takes the
64 // suggested color from the current page background. 65 // suggested color from the current page background.
65 virtual SkColor DelegatedFrameHostGetGutterColor(SkColor color) const = 0; 66 virtual SkColor DelegatedFrameHostGetGutterColor(SkColor color) const = 0;
66 virtual gfx::Size DelegatedFrameHostDesiredSizeInDIP() const = 0; 67 virtual gfx::Size DelegatedFrameHostDesiredSizeInDIP() const = 0;
67 68
68 virtual bool DelegatedFrameCanCreateResizeLock() const = 0; 69 virtual bool DelegatedFrameCanCreateResizeLock() const = 0;
69 virtual std::unique_ptr<ResizeLock> DelegatedFrameHostCreateResizeLock( 70 virtual std::unique_ptr<CompositorResizeLock>
70 bool defer_compositor_lock) = 0; 71 DelegatedFrameHostCreateResizeLock() = 0;
71 virtual void DelegatedFrameHostResizeLockWasReleased() = 0; 72 virtual void DelegatedFrameHostResizeLockWasReleased() = 0;
72 73
73 virtual void DelegatedFrameHostSendReclaimCompositorResources( 74 virtual void DelegatedFrameHostSendReclaimCompositorResources(
74 int compositor_frame_sink_id, 75 int compositor_frame_sink_id,
75 bool is_swap_ack, 76 bool is_swap_ack,
76 const cc::ReturnedResourceArray& resources) = 0; 77 const cc::ReturnedResourceArray& resources) = 0;
77 78
78 virtual void OnBeginFrame(const cc::BeginFrameArgs& args) = 0; 79 virtual void OnBeginFrame(const cc::BeginFrameArgs& args) = 0;
79 virtual bool IsAutoResizeEnabled() const = 0; 80 virtual bool IsAutoResizeEnabled() const = 0;
80 }; 81 };
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 gfx::Size current_surface_size_; 292 gfx::Size current_surface_size_;
292 float current_scale_factor_; 293 float current_scale_factor_;
293 cc::ReturnedResourceArray surface_returned_resources_; 294 cc::ReturnedResourceArray surface_returned_resources_;
294 295
295 // This lock is the one waiting for a frame of the right size to come back 296 // This lock is the one waiting for a frame of the right size to come back
296 // from the renderer/GPU process. It is set from the moment the aura window 297 // from the renderer/GPU process. It is set from the moment the aura window
297 // got resized, to the moment we committed the renderer frame of the same 298 // got resized, to the moment we committed the renderer frame of the same
298 // size. It keeps track of the size we expect from the renderer, and locks the 299 // size. It keeps track of the size we expect from the renderer, and locks the
299 // compositor, as well as the UI for a short time to give a chance to the 300 // compositor, as well as the UI for a short time to give a chance to the
300 // renderer of producing a frame of the right size. 301 // renderer of producing a frame of the right size.
301 std::unique_ptr<ResizeLock> resize_lock_; 302 std::unique_ptr<CompositorResizeLock> resize_lock_;
302 303
303 // Keeps track of the current frame size. 304 // Keeps track of the current frame size.
304 gfx::Size current_frame_size_in_dip_; 305 gfx::Size current_frame_size_in_dip_;
305 306
306 // This lock is for waiting for a front surface to become available to draw. 307 // This lock is for waiting for a front surface to become available to draw.
307 scoped_refptr<ui::CompositorLock> released_front_lock_; 308 std::unique_ptr<ui::CompositorLock> released_front_lock_;
308 309
309 enum CanLockCompositorState { 310 enum CanLockCompositorState {
310 YES_CAN_LOCK, 311 YES_CAN_LOCK,
311 // We locked, so at some point we'll need to kick a frame. 312 // We locked, so at some point we'll need to kick a frame.
312 YES_DID_LOCK, 313 YES_DID_LOCK,
313 // No. A lock timed out, we need to kick a new frame before locking again. 314 // No. A lock timed out, we need to kick a new frame before locking again.
314 NO_PENDING_RENDERER_FRAME, 315 NO_PENDING_RENDERER_FRAME,
315 // No. We've got a frame, but it hasn't been committed. 316 // No. We've got a frame, but it hasn't been committed.
316 NO_PENDING_COMMIT, 317 NO_PENDING_COMMIT,
317 }; 318 };
(...skipping 20 matching lines...) Expand all
338 cc::BeginFrameArgs::kInvalidFrameNumber; 339 cc::BeginFrameArgs::kInvalidFrameNumber;
339 340
340 bool has_frame_ = false; 341 bool has_frame_ = false;
341 342
342 std::unique_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; 343 std::unique_ptr<DelegatedFrameEvictor> delegated_frame_evictor_;
343 }; 344 };
344 345
345 } // namespace content 346 } // namespace content
346 347
347 #endif // CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_ 348 #endif // CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698