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/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
| 12 #include "cc/output/context_provider.h" |
11 #include "cc/output/software_output_device.h" | 13 #include "cc/output/software_output_device.h" |
12 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 14 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
13 | 15 |
14 namespace ui { struct LatencyInfo; } | 16 namespace ui { struct LatencyInfo; } |
15 | 17 |
16 namespace gfx { | 18 namespace gfx { |
17 class Rect; | 19 class Rect; |
18 class Size; | 20 class Size; |
19 } | 21 } |
20 | 22 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // Notifies frame-rate smoothness preference. If true, all non-critical | 101 // Notifies frame-rate smoothness preference. If true, all non-critical |
100 // processing should be stopped, or lowered in priority. | 102 // processing should be stopped, or lowered in priority. |
101 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} | 103 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} |
102 | 104 |
103 // Requests a BeginFrame notification from the output surface. The | 105 // Requests a BeginFrame notification from the output surface. The |
104 // notification will be delivered by calling | 106 // notification will be delivered by calling |
105 // OutputSurfaceClient::BeginFrame until the callback is disabled. | 107 // OutputSurfaceClient::BeginFrame until the callback is disabled. |
106 virtual void SetNeedsBeginFrame(bool enable) {} | 108 virtual void SetNeedsBeginFrame(bool enable) {} |
107 | 109 |
108 protected: | 110 protected: |
| 111 // Synchronously initialize context3d and enter hardware mode. |
| 112 // This can only supported in threaded compositing mode. |
| 113 // |offscreen_context_provider| should match what is returned by |
| 114 // LayerTreeClient::OffscreenContextProviderForCompositorThread. |
| 115 bool InitializeAndSetContext3D( |
| 116 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, |
| 117 scoped_refptr<ContextProvider> offscreen_context_provider); |
| 118 |
109 OutputSurfaceClient* client_; | 119 OutputSurfaceClient* client_; |
110 struct cc::OutputSurface::Capabilities capabilities_; | 120 struct cc::OutputSurface::Capabilities capabilities_; |
| 121 scoped_ptr<OutputSurfaceCallbacks> callbacks_; |
111 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; | 122 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; |
112 scoped_ptr<cc::SoftwareOutputDevice> software_device_; | 123 scoped_ptr<cc::SoftwareOutputDevice> software_device_; |
113 bool has_gl_discard_backbuffer_; | 124 bool has_gl_discard_backbuffer_; |
114 gfx::Size surface_size_; | 125 gfx::Size surface_size_; |
115 float device_scale_factor_; | 126 float device_scale_factor_; |
116 | 127 |
117 scoped_ptr<OutputSurfaceCallbacks> callbacks_; | |
118 | |
119 private: | 128 private: |
| 129 void SetContext3D(scoped_ptr<WebKit::WebGraphicsContext3D> context3d); |
120 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 130 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
121 }; | 131 }; |
122 | 132 |
123 } // namespace cc | 133 } // namespace cc |
124 | 134 |
125 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 135 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
OLD | NEW |