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/begin_frame_args.h" | |
13 #include "cc/output/context_provider.h" | 12 #include "cc/output/context_provider.h" |
14 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
15 | 14 |
16 namespace gfx { | 15 namespace gfx { |
17 class Transform; | 16 class Transform; |
18 } | 17 } |
19 | 18 |
20 namespace cc { | 19 namespace cc { |
21 | 20 |
22 class CompositorFrameAck; | 21 class CompositorFrameAck; |
23 struct ManagedMemoryPolicy; | 22 struct ManagedMemoryPolicy; |
24 | 23 |
25 class CC_EXPORT OutputSurfaceClient { | 24 class CC_EXPORT OutputSurfaceClient { |
26 public: | 25 public: |
27 // Called to synchronously re-initialize using the Context3D. Upon returning | 26 // Called to synchronously re-initialize using the Context3D. Upon returning |
28 // the compositor should be able to draw using GL what was previously | 27 // the compositor should be able to draw using GL what was previously |
29 // committed. | 28 // committed. |
30 virtual void DeferredInitialize() = 0; | 29 virtual void DeferredInitialize() = 0; |
31 // Must call OutputSurface::ReleaseContextProvider inside this call. | 30 // Must call OutputSurface::ReleaseContextProvider inside this call. |
32 virtual void ReleaseGL() = 0; | 31 virtual void ReleaseGL() = 0; |
33 virtual void CommitVSyncParameters(base::TimeTicks timebase, | 32 virtual void CommitVSyncParameters(base::TimeTicks timebase, |
34 base::TimeDelta interval) = 0; | 33 base::TimeDelta interval) = 0; |
35 virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) = 0; | 34 virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) = 0; |
36 virtual void BeginFrame(const BeginFrameArgs& args) = 0; | |
37 virtual void DidSwapBuffers() = 0; | 35 virtual void DidSwapBuffers() = 0; |
38 virtual void DidSwapBuffersComplete() = 0; | 36 virtual void DidSwapBuffersComplete() = 0; |
39 virtual void ReclaimResources(const CompositorFrameAck* ack) = 0; | 37 virtual void ReclaimResources(const CompositorFrameAck* ack) = 0; |
40 virtual void DidLoseOutputSurface() = 0; | 38 virtual void DidLoseOutputSurface() = 0; |
41 virtual void SetExternalDrawConstraints( | 39 virtual void SetExternalDrawConstraints( |
42 const gfx::Transform& transform, | 40 const gfx::Transform& transform, |
43 const gfx::Rect& viewport, | 41 const gfx::Rect& viewport, |
44 const gfx::Rect& clip, | 42 const gfx::Rect& clip, |
45 const gfx::Rect& viewport_rect_for_tile_priority, | 43 const gfx::Rect& viewport_rect_for_tile_priority, |
46 const gfx::Transform& transform_for_tile_priority, | 44 const gfx::Transform& transform_for_tile_priority, |
47 bool resourceless_software_draw) = 0; | 45 bool resourceless_software_draw) = 0; |
48 virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) = 0; | 46 virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) = 0; |
49 // 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, |
50 // regardless of the compositor visibility or damage. |callback| must remain | 48 // regardless of the compositor visibility or damage. |callback| must remain |
51 // valid for the lifetime of the OutputSurfaceClient or until unregisted -- | 49 // valid for the lifetime of the OutputSurfaceClient or until unregisted -- |
52 // use SetTreeActivationCallback(base::Closure()) to unregister it. | 50 // use SetTreeActivationCallback(base::Closure()) to unregister it. |
53 virtual void SetTreeActivationCallback(const base::Closure& callback) = 0; | 51 virtual void SetTreeActivationCallback(const base::Closure& callback) = 0; |
54 | 52 |
55 protected: | 53 protected: |
56 virtual ~OutputSurfaceClient() {} | 54 virtual ~OutputSurfaceClient() {} |
57 }; | 55 }; |
58 | 56 |
59 } // namespace cc | 57 } // namespace cc |
60 | 58 |
61 #endif // CC_OUTPUT_OUTPUT_SURFACE_CLIENT_H_ | 59 #endif // CC_OUTPUT_OUTPUT_SURFACE_CLIENT_H_ |
OLD | NEW |