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_H_ | 5 #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_ |
6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ | 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
13 #include "cc/output/context_provider.h" | 13 #include "cc/output/context_provider.h" |
14 #include "cc/output/software_output_device.h" | 14 #include "cc/output/software_output_device.h" |
15 #include "cc/scheduler/frame_rate_controller.h" | 15 #include "cc/scheduler/frame_rate_controller.h" |
16 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 16 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
17 | 17 |
| 18 namespace base { class SingleThreadTaskRunner; } |
| 19 |
18 namespace ui { struct LatencyInfo; } | 20 namespace ui { struct LatencyInfo; } |
19 | 21 |
20 namespace gfx { | 22 namespace gfx { |
21 class Rect; | 23 class Rect; |
22 class Size; | 24 class Size; |
23 class Transform; | 25 class Transform; |
24 } | 26 } |
25 | 27 |
26 namespace cc { | 28 namespace cc { |
27 | 29 |
28 class CompositorFrame; | 30 class CompositorFrame; |
29 class CompositorFrameAck; | 31 class CompositorFrameAck; |
30 class OutputSurfaceClient; | 32 class OutputSurfaceClient; |
31 class OutputSurfaceCallbacks; | 33 class OutputSurfaceCallbacks; |
32 class Thread; | |
33 | 34 |
34 // Represents the output surface for a compositor. The compositor owns | 35 // Represents the output surface for a compositor. The compositor owns |
35 // and manages its destruction. Its lifetime is: | 36 // and manages its destruction. Its lifetime is: |
36 // 1. Created on the main thread by the LayerTreeHost through its client. | 37 // 1. Created on the main thread by the LayerTreeHost through its client. |
37 // 2. Passed to the compositor thread and bound to a client via BindToClient. | 38 // 2. Passed to the compositor thread and bound to a client via BindToClient. |
38 // From here on, it will only be used on the compositor thread. | 39 // From here on, it will only be used on the compositor thread. |
39 // 3. If the 3D context is lost, then the compositor will delete the output | 40 // 3. If the 3D context is lost, then the compositor will delete the output |
40 // surface (on the compositor thread) and go back to step 1. | 41 // surface (on the compositor thread) and go back to step 1. |
41 class CC_EXPORT OutputSurface : public FrameRateControllerClient { | 42 class CC_EXPORT OutputSurface : public FrameRateControllerClient { |
42 public: | 43 public: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // device should be used on the current frame. | 82 // device should be used on the current frame. |
82 virtual bool ForcedDrawToSoftwareDevice() const; | 83 virtual bool ForcedDrawToSoftwareDevice() const; |
83 | 84 |
84 // Called by the compositor on the compositor thread. This is a place where | 85 // Called by the compositor on the compositor thread. This is a place where |
85 // thread-specific data for the output surface can be initialized, since from | 86 // thread-specific data for the output surface can be initialized, since from |
86 // this point on the output surface will only be used on the compositor | 87 // this point on the output surface will only be used on the compositor |
87 // thread. | 88 // thread. |
88 virtual bool BindToClient(OutputSurfaceClient* client); | 89 virtual bool BindToClient(OutputSurfaceClient* client); |
89 | 90 |
90 void InitializeBeginFrameEmulation( | 91 void InitializeBeginFrameEmulation( |
91 Thread* thread, | 92 base::SingleThreadTaskRunner* task_runner, |
92 bool throttle_frame_production, | 93 bool throttle_frame_production, |
93 base::TimeDelta interval); | 94 base::TimeDelta interval); |
94 | 95 |
95 void SetMaxFramesPending(int max_frames_pending); | 96 void SetMaxFramesPending(int max_frames_pending); |
96 | 97 |
97 virtual void EnsureBackbuffer(); | 98 virtual void EnsureBackbuffer(); |
98 virtual void DiscardBackbuffer(); | 99 virtual void DiscardBackbuffer(); |
99 | 100 |
100 virtual void Reshape(gfx::Size size, float scale_factor); | 101 virtual void Reshape(gfx::Size size, float scale_factor); |
101 virtual gfx::Size SurfaceSize() const; | 102 virtual gfx::Size SurfaceSize() const; |
102 | 103 |
103 virtual void BindFramebuffer(); | 104 virtual void BindFramebuffer(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 friend class OutputSurfaceCallbacks; | 164 friend class OutputSurfaceCallbacks; |
164 | 165 |
165 void SetContext3D(scoped_ptr<WebKit::WebGraphicsContext3D> context3d); | 166 void SetContext3D(scoped_ptr<WebKit::WebGraphicsContext3D> context3d); |
166 | 167 |
167 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 168 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
168 }; | 169 }; |
169 | 170 |
170 } // namespace cc | 171 } // namespace cc |
171 | 172 |
172 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 173 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
OLD | NEW |