OLD | NEW |
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> |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 namespace display_compositor { | 43 namespace display_compositor { |
44 class ReadbackYUVInterface; | 44 class ReadbackYUVInterface; |
45 } | 45 } |
46 | 46 |
47 namespace content { | 47 namespace content { |
48 | 48 |
49 class DelegatedFrameHost; | 49 class DelegatedFrameHost; |
50 class RenderWidgetHostViewFrameSubscriber; | 50 class RenderWidgetHostViewFrameSubscriber; |
51 class ResizeLock; | 51 class CompositorResizeLock; |
52 | 52 |
53 // The DelegatedFrameHostClient is the interface from the DelegatedFrameHost, | 53 // The DelegatedFrameHostClient is the interface from the DelegatedFrameHost, |
54 // which manages delegated frames, and the ui::Compositor being used to | 54 // which manages delegated frames, and the ui::Compositor being used to |
55 // display them. | 55 // display them. |
56 class CONTENT_EXPORT DelegatedFrameHostClient { | 56 class CONTENT_EXPORT DelegatedFrameHostClient { |
57 public: | 57 public: |
58 virtual ~DelegatedFrameHostClient() {} | 58 virtual ~DelegatedFrameHostClient() {} |
59 | 59 |
60 virtual ui::Layer* DelegatedFrameHostGetLayer() const = 0; | 60 virtual ui::Layer* DelegatedFrameHostGetLayer() const = 0; |
61 virtual bool DelegatedFrameHostIsVisible() const = 0; | 61 virtual bool DelegatedFrameHostIsVisible() const = 0; |
62 | 62 |
63 // Returns the color that the resize gutters should be drawn with. Takes the | 63 // Returns the color that the resize gutters should be drawn with. Takes the |
64 // suggested color from the current page background. | 64 // suggested color from the current page background. |
65 virtual SkColor DelegatedFrameHostGetGutterColor(SkColor color) const = 0; | 65 virtual SkColor DelegatedFrameHostGetGutterColor(SkColor color) const = 0; |
66 virtual gfx::Size DelegatedFrameHostDesiredSizeInDIP() const = 0; | 66 virtual gfx::Size DelegatedFrameHostDesiredSizeInDIP() const = 0; |
67 | 67 |
68 virtual bool DelegatedFrameCanCreateResizeLock() const = 0; | 68 virtual bool DelegatedFrameCanCreateResizeLock() const = 0; |
69 virtual std::unique_ptr<ResizeLock> DelegatedFrameHostCreateResizeLock( | 69 virtual std::unique_ptr<CompositorResizeLock> |
70 bool defer_compositor_lock) = 0; | 70 DelegatedFrameHostCreateResizeLock() = 0; |
71 virtual void DelegatedFrameHostResizeLockWasReleased() = 0; | 71 virtual void DelegatedFrameHostResizeLockWasReleased() = 0; |
72 | 72 |
73 virtual void DelegatedFrameHostSendReclaimCompositorResources( | 73 virtual void DelegatedFrameHostSendReclaimCompositorResources( |
74 int compositor_frame_sink_id, | 74 int compositor_frame_sink_id, |
75 bool is_swap_ack, | 75 bool is_swap_ack, |
76 const cc::ReturnedResourceArray& resources) = 0; | 76 const cc::ReturnedResourceArray& resources) = 0; |
77 | 77 |
78 virtual void SetBeginFrameSource(cc::BeginFrameSource* source) = 0; | 78 virtual void SetBeginFrameSource(cc::BeginFrameSource* source) = 0; |
79 virtual bool IsAutoResizeEnabled() const = 0; | 79 virtual bool IsAutoResizeEnabled() const = 0; |
80 }; | 80 }; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 gfx::Size current_surface_size_; | 292 gfx::Size current_surface_size_; |
293 float current_scale_factor_; | 293 float current_scale_factor_; |
294 cc::ReturnedResourceArray surface_returned_resources_; | 294 cc::ReturnedResourceArray surface_returned_resources_; |
295 | 295 |
296 // 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 |
297 // 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 |
298 // 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 |
299 // 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 |
300 // 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 |
301 // renderer of producing a frame of the right size. | 301 // renderer of producing a frame of the right size. |
302 std::unique_ptr<ResizeLock> resize_lock_; | 302 std::unique_ptr<CompositorResizeLock> resize_lock_; |
303 | 303 |
304 // Keeps track of the current frame size. | 304 // Keeps track of the current frame size. |
305 gfx::Size current_frame_size_in_dip_; | 305 gfx::Size current_frame_size_in_dip_; |
306 | 306 |
307 // 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. |
308 scoped_refptr<ui::CompositorLock> released_front_lock_; | 308 std::unique_ptr<ui::CompositorLock> released_front_lock_; |
309 | 309 |
310 enum CanLockCompositorState { | 310 enum CanLockCompositorState { |
311 YES_CAN_LOCK, | 311 YES_CAN_LOCK, |
312 // 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. |
313 YES_DID_LOCK, | 313 YES_DID_LOCK, |
314 // 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. |
315 NO_PENDING_RENDERER_FRAME, | 315 NO_PENDING_RENDERER_FRAME, |
316 // 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. |
317 NO_PENDING_COMMIT, | 317 NO_PENDING_COMMIT, |
318 }; | 318 }; |
(...skipping 21 matching lines...) Expand all Loading... |
340 cc::BeginFrameArgs::kInvalidFrameNumber; | 340 cc::BeginFrameArgs::kInvalidFrameNumber; |
341 | 341 |
342 bool has_frame_ = false; | 342 bool has_frame_ = false; |
343 | 343 |
344 std::unique_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; | 344 std::unique_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; |
345 }; | 345 }; |
346 | 346 |
347 } // namespace content | 347 } // namespace content |
348 | 348 |
349 #endif // CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_ | 349 #endif // CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_ |
OLD | NEW |