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/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
11 #include "cc/output/software_output_device.h" | 11 #include "cc/output/software_output_device.h" |
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
13 | 13 |
| 14 namespace ui { struct LatencyInfo; } |
| 15 |
14 namespace gfx { | 16 namespace gfx { |
15 class Rect; | 17 class Rect; |
16 class Size; | 18 class Size; |
17 } | 19 } |
18 | 20 |
19 namespace cc { | 21 namespace cc { |
20 | 22 |
21 class CompositorFrame; | 23 class CompositorFrame; |
22 class OutputSurfaceClient; | 24 class OutputSurfaceClient; |
23 class OutputSurfaceCallbacks; | 25 class OutputSurfaceCallbacks; |
24 struct LatencyInfo; | |
25 | 26 |
26 // Represents the output surface for a compositor. The compositor owns | 27 // Represents the output surface for a compositor. The compositor owns |
27 // and manages its destruction. Its lifetime is: | 28 // and manages its destruction. Its lifetime is: |
28 // 1. Created on the main thread by the LayerTreeHost through its client. | 29 // 1. Created on the main thread by the LayerTreeHost through its client. |
29 // 2. Passed to the compositor thread and bound to a client via BindToClient. | 30 // 2. Passed to the compositor thread and bound to a client via BindToClient. |
30 // From here on, it will only be used on the compositor thread. | 31 // From here on, it will only be used on the compositor thread. |
31 // 3. If the 3D context is lost, then the compositor will delete the output | 32 // 3. If the 3D context is lost, then the compositor will delete the output |
32 // surface (on the compositor thread) and go back to step 1. | 33 // surface (on the compositor thread) and go back to step 1. |
33 class CC_EXPORT OutputSurface { | 34 class CC_EXPORT OutputSurface { |
34 public: | 35 public: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // steal the contents of the CompositorFrame passed in. | 85 // steal the contents of the CompositorFrame passed in. |
85 virtual void SendFrameToParentCompositor(CompositorFrame* frame); | 86 virtual void SendFrameToParentCompositor(CompositorFrame* frame); |
86 | 87 |
87 virtual void EnsureBackbuffer(); | 88 virtual void EnsureBackbuffer(); |
88 virtual void DiscardBackbuffer(); | 89 virtual void DiscardBackbuffer(); |
89 | 90 |
90 virtual void Reshape(gfx::Size size, float scale_factor); | 91 virtual void Reshape(gfx::Size size, float scale_factor); |
91 | 92 |
92 virtual void BindFramebuffer(); | 93 virtual void BindFramebuffer(); |
93 | 94 |
94 virtual void PostSubBuffer(gfx::Rect rect, const LatencyInfo&); | 95 virtual void PostSubBuffer(gfx::Rect rect, const ui::LatencyInfo&); |
95 virtual void SwapBuffers(const LatencyInfo&); | 96 virtual void SwapBuffers(const ui::LatencyInfo&); |
96 | 97 |
97 // Notifies frame-rate smoothness preference. If true, all non-critical | 98 // Notifies frame-rate smoothness preference. If true, all non-critical |
98 // processing should be stopped, or lowered in priority. | 99 // processing should be stopped, or lowered in priority. |
99 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} | 100 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} |
100 | 101 |
101 // Requests a BeginFrame notification from the output surface. The | 102 // Requests a BeginFrame notification from the output surface. The |
102 // notification will be delivered by calling | 103 // notification will be delivered by calling |
103 // OutputSurfaceClient::BeginFrame until the callback is disabled. | 104 // OutputSurfaceClient::BeginFrame until the callback is disabled. |
104 virtual void SetNeedsBeginFrame(bool enable) {} | 105 virtual void SetNeedsBeginFrame(bool enable) {} |
105 | 106 |
106 protected: | 107 protected: |
107 OutputSurfaceClient* client_; | 108 OutputSurfaceClient* client_; |
108 struct cc::OutputSurface::Capabilities capabilities_; | 109 struct cc::OutputSurface::Capabilities capabilities_; |
109 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; | 110 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; |
110 scoped_ptr<cc::SoftwareOutputDevice> software_device_; | 111 scoped_ptr<cc::SoftwareOutputDevice> software_device_; |
111 bool has_gl_discard_backbuffer_; | 112 bool has_gl_discard_backbuffer_; |
112 | 113 |
113 scoped_ptr<OutputSurfaceCallbacks> callbacks_; | 114 scoped_ptr<OutputSurfaceCallbacks> callbacks_; |
114 | 115 |
115 private: | 116 private: |
116 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 117 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
117 }; | 118 }; |
118 | 119 |
119 } // namespace cc | 120 } // namespace cc |
120 | 121 |
121 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 122 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
OLD | NEW |