OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CC_OUTPUT_OUTPUT_SURFACE_CLIENT_H_ | 5 #ifndef CC_OUTPUT_COMPOSITOR_FRAME_SINK_CLIENT_H_ |
6 #define CC_OUTPUT_OUTPUT_SURFACE_CLIENT_H_ | 6 #define CC_OUTPUT_COMPOSITOR_FRAME_SINK_CLIENT_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
12 #include "cc/output/context_provider.h" | 12 #include "cc/output/context_provider.h" |
13 #include "cc/resources/returned_resource.h" | 13 #include "cc/resources/returned_resource.h" |
14 #include "gpu/command_buffer/common/texture_in_use_response.h" | 14 #include "gpu/command_buffer/common/texture_in_use_response.h" |
15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
16 | 16 |
17 namespace gfx { | 17 namespace gfx { |
18 class Transform; | 18 class Transform; |
19 } | 19 } |
20 | 20 |
21 namespace cc { | 21 namespace cc { |
22 | 22 |
23 class BeginFrameSource; | 23 class BeginFrameSource; |
24 struct ManagedMemoryPolicy; | 24 struct ManagedMemoryPolicy; |
25 | 25 |
26 class CC_EXPORT OutputSurfaceClient { | 26 class CC_EXPORT CompositorFrameSinkClient { |
27 public: | 27 public: |
28 // ============== DISPLAY COMPOSITOR ONLY ======================= | 28 // ============== DISPLAY COMPOSITOR ONLY ======================= |
29 | 29 |
30 // From surfaceless/ozone browser compositor output surface. | 30 // From surfaceless/ozone browser compositor output surface. |
31 virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) = 0; | 31 virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) = 0; |
32 // For overlays. | 32 // For overlays. |
33 virtual void DidReceiveTextureInUseResponses( | 33 virtual void DidReceiveTextureInUseResponses( |
34 const gpu::TextureInUseResponses& responses) = 0; | 34 const gpu::TextureInUseResponses& responses) = 0; |
35 | 35 |
36 // ============== LAYER TREE COMPOSITOR ONLY ==================== | 36 // ============== LAYER TREE COMPOSITOR ONLY ==================== |
37 | 37 |
38 // Pass the begin frame source for the client to observe. Client does not own | 38 // Pass the begin frame source for the client to observe. Client does not own |
39 // the BeginFrameSource. OutputSurface should call this once after binding to | 39 // the BeginFrameSource. CompositorFrameSink should call this once after |
| 40 // binding to |
40 // the client and then call again with a null while detaching. | 41 // the client and then call again with a null while detaching. |
41 virtual void SetBeginFrameSource(BeginFrameSource* source) = 0; | 42 virtual void SetBeginFrameSource(BeginFrameSource* source) = 0; |
42 virtual void ReclaimResources(const ReturnedResourceArray& resources) = 0; | 43 virtual void ReclaimResources(const ReturnedResourceArray& resources) = 0; |
43 // For WebView. | 44 // For WebView. |
44 virtual void SetExternalTilePriorityConstraints( | 45 virtual void SetExternalTilePriorityConstraints( |
45 const gfx::Rect& viewport_rect, | 46 const gfx::Rect& viewport_rect, |
46 const gfx::Transform& transform) = 0; | 47 const gfx::Transform& transform) = 0; |
47 // If set, |callback| will be called subsequent to each new tree activation, | 48 // If set, |callback| will be called subsequent to each new tree activation, |
48 // regardless of the compositor visibility or damage. |callback| must remain | 49 // regardless of the compositor visibility or damage. |callback| must remain |
49 // valid for the lifetime of the OutputSurfaceClient or until unregisted -- | 50 // valid for the lifetime of the CompositorFrameSinkClient or until unregisted |
| 51 // -- |
50 // use SetTreeActivationCallback(base::Closure()) to unregister it. | 52 // use SetTreeActivationCallback(base::Closure()) to unregister it. |
51 virtual void SetTreeActivationCallback(const base::Closure& callback) = 0; | 53 virtual void SetTreeActivationCallback(const base::Closure& callback) = 0; |
52 // This allows the output surface to ask its client for a draw. | 54 // This allows the output surface to ask its client for a draw. |
53 virtual void OnDraw(const gfx::Transform& transform, | 55 virtual void OnDraw(const gfx::Transform& transform, |
54 const gfx::Rect& viewport, | 56 const gfx::Rect& viewport, |
55 bool resourceless_software_draw) = 0; | 57 bool resourceless_software_draw) = 0; |
56 // For SynchronousCompositor (WebView) to set how much memory the compositor | 58 // For SynchronousCompositor (WebView) to set how much memory the compositor |
57 // can use without changing visibility. | 59 // can use without changing visibility. |
58 virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) = 0; | 60 virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) = 0; |
59 | 61 |
60 // ============== BOTH TYPES OF COMPOSITOR ====================== | 62 // ============== BOTH TYPES OF COMPOSITOR ====================== |
61 | 63 |
62 // For LayerTreeHostImpl, this is more of a OnSwapBuffersAck from the display | 64 // For LayerTreeHostImpl, this is more of a OnSwapBuffersAck from the display |
63 // compositor that it received and will use the frame, unblocking it from | 65 // compositor that it received and will use the frame, unblocking it from |
64 // producing more frames. | 66 // producing more frames. |
65 // For the display compositor this is literally a notification that the swap | 67 // For the display compositor this is literally a notification that the swap |
66 // to the hardware is complete. | 68 // to the hardware is complete. |
67 virtual void DidSwapBuffersComplete() = 0; | 69 virtual void DidSwapBuffersComplete() = 0; |
68 | 70 |
69 // Needs thought, if LTHI has only context providers, it needs to register a | 71 // Needs thought, if LTHI has only context providers, it needs to register a |
70 // lost callback, so we need to support multiple callbacks. | 72 // lost callback, so we need to support multiple callbacks. |
71 virtual void DidLoseOutputSurface() = 0; | 73 virtual void DidLoseCompositorFrameSink() = 0; |
72 | 74 |
73 protected: | 75 protected: |
74 virtual ~OutputSurfaceClient() {} | 76 virtual ~CompositorFrameSinkClient() {} |
75 }; | 77 }; |
76 | 78 |
77 } // namespace cc | 79 } // namespace cc |
78 | 80 |
79 #endif // CC_OUTPUT_OUTPUT_SURFACE_CLIENT_H_ | 81 #endif // CC_OUTPUT_COMPOSITOR_FRAME_SINK_CLIENT_H_ |
OLD | NEW |