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_OUTPUT_SURFACE_CLIENT_H_ |
6 #define CC_OUTPUT_OUTPUT_SURFACE_CLIENT_H_ | 6 #define CC_OUTPUT_OUTPUT_SURFACE_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 "gpu/command_buffer/common/texture_in_use_response.h" |
13 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
14 | 15 |
15 namespace gfx { | 16 namespace gfx { |
16 class Transform; | 17 class Transform; |
17 } | 18 } |
18 | 19 |
19 namespace cc { | 20 namespace cc { |
20 | 21 |
21 class BeginFrameSource; | 22 class BeginFrameSource; |
22 class CompositorFrameAck; | 23 class CompositorFrameAck; |
23 struct ManagedMemoryPolicy; | 24 struct ManagedMemoryPolicy; |
24 | 25 |
25 class CC_EXPORT OutputSurfaceClient { | 26 class CC_EXPORT OutputSurfaceClient { |
26 public: | 27 public: |
27 // TODO(enne): Remove this in favor of using SetBeginFrameSource. | 28 // TODO(enne): Remove this in favor of using SetBeginFrameSource. |
28 virtual void CommitVSyncParameters(base::TimeTicks timebase, | 29 virtual void CommitVSyncParameters(base::TimeTicks timebase, |
29 base::TimeDelta interval) = 0; | 30 base::TimeDelta interval) = 0; |
30 // Pass the begin frame source for the client to observe. Client does not own | 31 // Pass the begin frame source for the client to observe. Client does not own |
31 // the BeginFrameSource. OutputSurface should call this once after binding to | 32 // the BeginFrameSource. OutputSurface should call this once after binding to |
32 // the client and then call again with a null while detaching. | 33 // the client and then call again with a null while detaching. |
33 virtual void SetBeginFrameSource(BeginFrameSource* source) = 0; | 34 virtual void SetBeginFrameSource(BeginFrameSource* source) = 0; |
34 | 35 |
35 virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) = 0; | 36 virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) = 0; |
36 virtual void DidSwapBuffers() = 0; | 37 virtual void DidSwapBuffers() = 0; |
37 virtual void DidSwapBuffersComplete() = 0; | 38 virtual void DidSwapBuffersComplete() = 0; |
| 39 virtual void DidReceiveTextureInUseResponses( |
| 40 const gpu::TextureInUseResponses& responses) = 0; |
38 virtual void ReclaimResources(const CompositorFrameAck* ack) = 0; | 41 virtual void ReclaimResources(const CompositorFrameAck* ack) = 0; |
39 virtual void DidLoseOutputSurface() = 0; | 42 virtual void DidLoseOutputSurface() = 0; |
40 virtual void SetExternalTilePriorityConstraints( | 43 virtual void SetExternalTilePriorityConstraints( |
41 const gfx::Rect& viewport_rect, | 44 const gfx::Rect& viewport_rect, |
42 const gfx::Transform& transform) = 0; | 45 const gfx::Transform& transform) = 0; |
43 virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) = 0; | 46 virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) = 0; |
44 // If set, |callback| will be called subsequent to each new tree activation, | 47 // If set, |callback| will be called subsequent to each new tree activation, |
45 // regardless of the compositor visibility or damage. |callback| must remain | 48 // regardless of the compositor visibility or damage. |callback| must remain |
46 // valid for the lifetime of the OutputSurfaceClient or until unregisted -- | 49 // valid for the lifetime of the OutputSurfaceClient or until unregisted -- |
47 // use SetTreeActivationCallback(base::Closure()) to unregister it. | 50 // use SetTreeActivationCallback(base::Closure()) to unregister it. |
48 virtual void SetTreeActivationCallback(const base::Closure& callback) = 0; | 51 virtual void SetTreeActivationCallback(const base::Closure& callback) = 0; |
49 // This allows the output surface to ask its client for a draw. | 52 // This allows the output surface to ask its client for a draw. |
50 virtual void OnDraw(const gfx::Transform& transform, | 53 virtual void OnDraw(const gfx::Transform& transform, |
51 const gfx::Rect& viewport, | 54 const gfx::Rect& viewport, |
52 const gfx::Rect& clip, | 55 const gfx::Rect& clip, |
53 bool resourceless_software_draw) = 0; | 56 bool resourceless_software_draw) = 0; |
54 | 57 |
55 protected: | 58 protected: |
56 virtual ~OutputSurfaceClient() {} | 59 virtual ~OutputSurfaceClient() {} |
57 }; | 60 }; |
58 | 61 |
59 } // namespace cc | 62 } // namespace cc |
60 | 63 |
61 #endif // CC_OUTPUT_OUTPUT_SURFACE_CLIENT_H_ | 64 #endif // CC_OUTPUT_OUTPUT_SURFACE_CLIENT_H_ |
OLD | NEW |