OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 CCLayerTreeHost_h | 5 #ifndef CCLayerTreeHost_h |
6 #define CCLayerTreeHost_h | 6 #define CCLayerTreeHost_h |
7 | 7 |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 bool usingSetVisibility; | 86 bool usingSetVisibility; |
87 bool usingSwapCompleteCallback; | 87 bool usingSwapCompleteCallback; |
88 bool usingGpuMemoryManager; | 88 bool usingGpuMemoryManager; |
89 bool usingDiscardFramebuffer; | 89 bool usingDiscardFramebuffer; |
90 bool usingEglImage; | 90 bool usingEglImage; |
91 int maxTextureSize; | 91 int maxTextureSize; |
92 }; | 92 }; |
93 | 93 |
94 class LayerTreeHost : public RateLimiterClient { | 94 class LayerTreeHost : public RateLimiterClient { |
95 public: | 95 public: |
96 static scoped_ptr<LayerTreeHost> create(LayerTreeHostClient*, const LayerTre
eSettings&); | 96 static scoped_ptr<LayerTreeHost> create(LayerTreeHostClient*, const LayerTre
eSettings&, scoped_ptr<Thread> implThread); |
97 virtual ~LayerTreeHost(); | 97 virtual ~LayerTreeHost(); |
98 | 98 |
99 void setSurfaceReady(); | 99 void setSurfaceReady(); |
100 | 100 |
101 // Returns true if any LayerTreeHost is alive. | 101 // Returns true if any LayerTreeHost is alive. |
102 static bool anyLayerTreeHostInstanceExists(); | 102 static bool anyLayerTreeHostInstanceExists(); |
103 | 103 |
104 static bool needsFilterContext() { return s_needsFilterContext; } | 104 static bool needsFilterContext() { return s_needsFilterContext; } |
105 static void setNeedsFilterContext(bool needsFilterContext) { s_needsFilterCo
ntext = needsFilterContext; } | 105 static void setNeedsFilterContext(bool needsFilterContext) { s_needsFilterCo
ntext = needsFilterContext; } |
106 bool needsSharedContext() const { return needsFilterContext() || settings().
acceleratePainting; } | 106 bool needsSharedContext() const { return needsFilterContext() || settings().
acceleratePainting; } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 bool bufferedUpdates(); | 205 bool bufferedUpdates(); |
206 bool requestPartialTextureUpdate(); | 206 bool requestPartialTextureUpdate(); |
207 | 207 |
208 void setDeviceScaleFactor(float); | 208 void setDeviceScaleFactor(float); |
209 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 209 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
210 | 210 |
211 void setFontAtlas(scoped_ptr<FontAtlas>); | 211 void setFontAtlas(scoped_ptr<FontAtlas>); |
212 | 212 |
213 HeadsUpDisplayLayer* hudLayer() const { return m_hudLayer.get(); } | 213 HeadsUpDisplayLayer* hudLayer() const { return m_hudLayer.get(); } |
214 | 214 |
| 215 Proxy* proxy() const { return m_proxy.get(); } |
| 216 |
215 protected: | 217 protected: |
216 LayerTreeHost(LayerTreeHostClient*, const LayerTreeSettings&); | 218 LayerTreeHost(LayerTreeHostClient*, const LayerTreeSettings&); |
217 bool initialize(); | 219 bool initialize(scoped_ptr<Thread> implThread); |
218 | 220 |
219 private: | 221 private: |
220 typedef std::vector<scoped_refptr<Layer> > LayerList; | 222 typedef std::vector<scoped_refptr<Layer> > LayerList; |
221 | 223 |
222 void initializeRenderer(); | 224 void initializeRenderer(); |
223 | 225 |
224 void update(Layer*, ResourceUpdateQueue&, const OcclusionTracker*); | 226 void update(Layer*, ResourceUpdateQueue&, const OcclusionTracker*); |
225 bool paintLayerContents(const LayerList&, ResourceUpdateQueue&); | 227 bool paintLayerContents(const LayerList&, ResourceUpdateQueue&); |
226 bool paintMasksForRenderSurface(Layer*, ResourceUpdateQueue&); | 228 bool paintMasksForRenderSurface(Layer*, ResourceUpdateQueue&); |
227 | 229 |
228 void updateLayers(Layer*, ResourceUpdateQueue&); | 230 void updateLayers(Layer*, ResourceUpdateQueue&); |
229 void triggerPrepaint(); | 231 void triggerPrepaint(); |
230 | 232 |
231 void prioritizeTextures(const LayerList&, OverdrawMetrics&); | 233 void prioritizeTextures(const LayerList&, OverdrawMetrics&); |
232 void setPrioritiesForSurfaces(size_t surfaceMemoryBytes); | 234 void setPrioritiesForSurfaces(size_t surfaceMemoryBytes); |
233 void setPrioritiesForLayers(const LayerList&); | 235 void setPrioritiesForLayers(const LayerList&); |
234 size_t calculateMemoryForRenderSurfaces(const LayerList& updateList); | 236 size_t calculateMemoryForRenderSurfaces(const LayerList& updateList); |
235 | 237 |
236 void animateLayers(base::TimeTicks monotonicTime); | 238 void animateLayers(base::TimeTicks monotonicTime); |
237 bool animateLayersRecursive(Layer* current, base::TimeTicks time); | 239 bool animateLayersRecursive(Layer* current, base::TimeTicks time); |
238 void setAnimationEventsRecursive(const AnimationEventsVector&, Layer*, base:
:Time wallClockTime); | 240 void setAnimationEventsRecursive(const AnimationEventsVector&, Layer*, base:
:Time wallClockTime); |
239 | 241 |
240 bool m_animating; | 242 bool m_animating; |
241 bool m_needsAnimateLayers; | 243 bool m_needsAnimateLayers; |
242 | 244 |
243 base::CancelableClosure m_prepaintCallback; | 245 base::CancelableClosure m_prepaintCallback; |
244 | 246 |
245 LayerTreeHostClient* m_client; | 247 LayerTreeHostClient* m_client; |
| 248 scoped_ptr<Proxy> m_proxy; |
246 | 249 |
247 int m_commitNumber; | 250 int m_commitNumber; |
248 RenderingStats m_renderingStats; | 251 RenderingStats m_renderingStats; |
249 | 252 |
250 scoped_ptr<Proxy> m_proxy; | |
251 bool m_rendererInitialized; | 253 bool m_rendererInitialized; |
252 bool m_contextLost; | 254 bool m_contextLost; |
253 int m_numTimesRecreateShouldFail; | 255 int m_numTimesRecreateShouldFail; |
254 int m_numFailedRecreateAttempts; | 256 int m_numFailedRecreateAttempts; |
255 | 257 |
256 scoped_refptr<Layer> m_rootLayer; | 258 scoped_refptr<Layer> m_rootLayer; |
257 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; | 259 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; |
258 scoped_ptr<FontAtlas> m_fontAtlas; | 260 scoped_ptr<FontAtlas> m_fontAtlas; |
259 | 261 |
260 scoped_ptr<PrioritizedTextureManager> m_contentsTextureManager; | 262 scoped_ptr<PrioritizedTextureManager> m_contentsTextureManager; |
(...skipping 22 matching lines...) Expand all Loading... |
283 size_t m_partialTextureUpdateRequests; | 285 size_t m_partialTextureUpdateRequests; |
284 | 286 |
285 static bool s_needsFilterContext; | 287 static bool s_needsFilterContext; |
286 | 288 |
287 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 289 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
288 }; | 290 }; |
289 | 291 |
290 } // namespace cc | 292 } // namespace cc |
291 | 293 |
292 #endif | 294 #endif |
OLD | NEW |