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 <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // surface. Either of these may return a null pointer, but not both. | 87 // surface. Either of these may return a null pointer, but not both. |
88 // In the event of a lost context, the entire output surface should be | 88 // In the event of a lost context, the entire output surface should be |
89 // recreated. | 89 // recreated. |
90 scoped_refptr<ContextProvider> context_provider() const { | 90 scoped_refptr<ContextProvider> context_provider() const { |
91 return context_provider_.get(); | 91 return context_provider_.get(); |
92 } | 92 } |
93 SoftwareOutputDevice* software_device() const { | 93 SoftwareOutputDevice* software_device() const { |
94 return software_device_.get(); | 94 return software_device_.get(); |
95 } | 95 } |
96 | 96 |
97 // In the case where both the context3d and software_device are present | |
98 // (namely Android WebView), this is called to determine whether the software | |
99 // device should be used on the current frame. | |
100 virtual bool ForcedDrawToSoftwareDevice() const; | |
101 | |
102 // Called by the compositor on the compositor thread. This is a place where | 97 // Called by the compositor on the compositor thread. This is a place where |
103 // thread-specific data for the output surface can be initialized, since from | 98 // thread-specific data for the output surface can be initialized, since from |
104 // this point on the output surface will only be used on the compositor | 99 // this point on the output surface will only be used on the compositor |
105 // thread. | 100 // thread. |
106 virtual bool BindToClient(OutputSurfaceClient* client); | 101 virtual bool BindToClient(OutputSurfaceClient* client); |
107 | 102 |
108 // This is called by the compositor on the compositor thread inside ReleaseGL | 103 // This is called by the compositor on the compositor thread inside ReleaseGL |
109 // in order to release the ContextProvider. Only used with | 104 // in order to release the ContextProvider. Only used with |
110 // deferred_gl_initialization capability. | 105 // deferred_gl_initialization capability. |
111 void ReleaseContextProvider(); | 106 void ReleaseContextProvider(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 void CommitVSyncParameters(base::TimeTicks timebase, | 163 void CommitVSyncParameters(base::TimeTicks timebase, |
169 base::TimeDelta interval); | 164 base::TimeDelta interval); |
170 | 165 |
171 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); | 166 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); |
172 void ReclaimResources(const CompositorFrameAck* ack); | 167 void ReclaimResources(const CompositorFrameAck* ack); |
173 void DidLoseOutputSurface(); | 168 void DidLoseOutputSurface(); |
174 void SetExternalStencilTest(bool enabled); | 169 void SetExternalStencilTest(bool enabled); |
175 void SetExternalDrawConstraints(const gfx::Transform& transform, | 170 void SetExternalDrawConstraints(const gfx::Transform& transform, |
176 const gfx::Rect& viewport, | 171 const gfx::Rect& viewport, |
177 const gfx::Rect& clip, | 172 const gfx::Rect& clip, |
| 173 bool resourceless_software_draw, |
178 bool valid_for_tile_management); | 174 bool valid_for_tile_management); |
179 | 175 |
180 private: | 176 private: |
181 void SetUpContext3d(); | 177 void SetUpContext3d(); |
182 void ResetContext3d(); | 178 void ResetContext3d(); |
183 void SetMemoryPolicy(const ManagedMemoryPolicy& policy); | 179 void SetMemoryPolicy(const ManagedMemoryPolicy& policy); |
184 void UpdateAndMeasureGpuLatency(); | 180 void UpdateAndMeasureGpuLatency(); |
185 | 181 |
186 bool external_stencil_test_enabled_; | 182 bool external_stencil_test_enabled_; |
187 | 183 |
188 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; | 184 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; |
189 | 185 |
190 std::deque<unsigned> available_gpu_latency_query_ids_; | 186 std::deque<unsigned> available_gpu_latency_query_ids_; |
191 std::deque<unsigned> pending_gpu_latency_query_ids_; | 187 std::deque<unsigned> pending_gpu_latency_query_ids_; |
192 RollingTimeDeltaHistory gpu_latency_history_; | 188 RollingTimeDeltaHistory gpu_latency_history_; |
193 | 189 |
194 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 190 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
195 }; | 191 }; |
196 | 192 |
197 } // namespace cc | 193 } // namespace cc |
198 | 194 |
199 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 195 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
OLD | NEW |