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 "CCAnimationEvents.h" | 10 #include "CCAnimationEvents.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 bool usingSetVisibility; | 83 bool usingSetVisibility; |
84 bool usingSwapCompleteCallback; | 84 bool usingSwapCompleteCallback; |
85 bool usingGpuMemoryManager; | 85 bool usingGpuMemoryManager; |
86 bool usingDiscardFramebuffer; | 86 bool usingDiscardFramebuffer; |
87 bool usingEglImage; | 87 bool usingEglImage; |
88 int maxTextureSize; | 88 int maxTextureSize; |
89 }; | 89 }; |
90 | 90 |
91 class LayerTreeHost : public RateLimiterClient { | 91 class LayerTreeHost : public RateLimiterClient { |
92 public: | 92 public: |
93 static scoped_ptr<LayerTreeHost> create(LayerTreeHostClient*, const LayerTre eSettings&); | 93 static scoped_ptr<LayerTreeHost> create(LayerTreeHostClient*, const LayerTre eSettings&, Thread*); |
danakj
2012/10/25 05:06:06
add "implThread" name here? The Thread* isn't supe
| |
94 virtual ~LayerTreeHost(); | 94 virtual ~LayerTreeHost(); |
95 | 95 |
96 void setSurfaceReady(); | 96 void setSurfaceReady(); |
97 | 97 |
98 // Returns true if any LayerTreeHost is alive. | 98 // Returns true if any LayerTreeHost is alive. |
99 static bool anyLayerTreeHostInstanceExists(); | 99 static bool anyLayerTreeHostInstanceExists(); |
100 | 100 |
101 static bool needsFilterContext() { return s_needsFilterContext; } | 101 static bool needsFilterContext() { return s_needsFilterContext; } |
102 static void setNeedsFilterContext(bool needsFilterContext) { s_needsFilterCo ntext = needsFilterContext; } | 102 static void setNeedsFilterContext(bool needsFilterContext) { s_needsFilterCo ntext = needsFilterContext; } |
103 bool needsSharedContext() const { return needsFilterContext() || settings(). acceleratePainting; } | 103 bool needsSharedContext() const { return needsFilterContext() || settings(). acceleratePainting; } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 bool requestPartialTextureUpdate(); | 197 bool requestPartialTextureUpdate(); |
198 void deleteTextureAfterCommit(scoped_ptr<PrioritizedTexture>); | 198 void deleteTextureAfterCommit(scoped_ptr<PrioritizedTexture>); |
199 | 199 |
200 void setDeviceScaleFactor(float); | 200 void setDeviceScaleFactor(float); |
201 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 201 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
202 | 202 |
203 void setFontAtlas(scoped_ptr<FontAtlas>); | 203 void setFontAtlas(scoped_ptr<FontAtlas>); |
204 | 204 |
205 HeadsUpDisplayLayer* hudLayer() const { return m_hudLayer.get(); } | 205 HeadsUpDisplayLayer* hudLayer() const { return m_hudLayer.get(); } |
206 | 206 |
207 Proxy* proxy() const { return m_proxy.get(); } | |
208 | |
207 protected: | 209 protected: |
208 LayerTreeHost(LayerTreeHostClient*, const LayerTreeSettings&); | 210 LayerTreeHost(LayerTreeHostClient*, const LayerTreeSettings&); |
209 bool initialize(); | 211 bool initialize(Thread* implThread); |
210 | 212 |
211 private: | 213 private: |
212 typedef std::vector<scoped_refptr<Layer> > LayerList; | 214 typedef std::vector<scoped_refptr<Layer> > LayerList; |
213 | 215 |
214 void initializeRenderer(); | 216 void initializeRenderer(); |
215 | 217 |
216 void update(Layer*, TextureUpdateQueue&, const OcclusionTracker*); | 218 void update(Layer*, TextureUpdateQueue&, const OcclusionTracker*); |
217 bool paintLayerContents(const LayerList&, TextureUpdateQueue&); | 219 bool paintLayerContents(const LayerList&, TextureUpdateQueue&); |
218 bool paintMasksForRenderSurface(Layer*, TextureUpdateQueue&); | 220 bool paintMasksForRenderSurface(Layer*, TextureUpdateQueue&); |
219 | 221 |
220 void updateLayers(Layer*, TextureUpdateQueue&); | 222 void updateLayers(Layer*, TextureUpdateQueue&); |
221 | 223 |
222 void prioritizeTextures(const LayerList&, OverdrawMetrics&); | 224 void prioritizeTextures(const LayerList&, OverdrawMetrics&); |
223 void setPrioritiesForSurfaces(size_t surfaceMemoryBytes); | 225 void setPrioritiesForSurfaces(size_t surfaceMemoryBytes); |
224 void setPrioritiesForLayers(const LayerList&); | 226 void setPrioritiesForLayers(const LayerList&); |
225 size_t calculateMemoryForRenderSurfaces(const LayerList& updateList); | 227 size_t calculateMemoryForRenderSurfaces(const LayerList& updateList); |
226 | 228 |
227 void animateLayers(double monotonicTime); | 229 void animateLayers(double monotonicTime); |
228 bool animateLayersRecursive(Layer* current, double monotonicTime); | 230 bool animateLayersRecursive(Layer* current, double monotonicTime); |
229 void setAnimationEventsRecursive(const AnimationEventsVector&, Layer*, doubl e wallClockTime); | 231 void setAnimationEventsRecursive(const AnimationEventsVector&, Layer*, doubl e wallClockTime); |
230 | 232 |
231 bool m_animating; | 233 bool m_animating; |
232 bool m_needsAnimateLayers; | 234 bool m_needsAnimateLayers; |
233 | 235 |
234 LayerTreeHostClient* m_client; | 236 LayerTreeHostClient* m_client; |
237 scoped_ptr<Proxy> m_proxy; | |
235 | 238 |
236 int m_commitNumber; | 239 int m_commitNumber; |
237 RenderingStats m_renderingStats; | 240 RenderingStats m_renderingStats; |
238 | 241 |
239 scoped_ptr<Proxy> m_proxy; | |
240 bool m_rendererInitialized; | 242 bool m_rendererInitialized; |
241 bool m_contextLost; | 243 bool m_contextLost; |
242 int m_numTimesRecreateShouldFail; | 244 int m_numTimesRecreateShouldFail; |
243 int m_numFailedRecreateAttempts; | 245 int m_numFailedRecreateAttempts; |
244 | 246 |
245 scoped_refptr<Layer> m_rootLayer; | 247 scoped_refptr<Layer> m_rootLayer; |
246 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; | 248 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; |
247 scoped_ptr<FontAtlas> m_fontAtlas; | 249 scoped_ptr<FontAtlas> m_fontAtlas; |
248 | 250 |
249 scoped_ptr<PrioritizedTextureManager> m_contentsTextureManager; | 251 scoped_ptr<PrioritizedTextureManager> m_contentsTextureManager; |
(...skipping 23 matching lines...) Expand all Loading... | |
273 size_t m_partialTextureUpdateRequests; | 275 size_t m_partialTextureUpdateRequests; |
274 | 276 |
275 static bool s_needsFilterContext; | 277 static bool s_needsFilterContext; |
276 | 278 |
277 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 279 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
278 }; | 280 }; |
279 | 281 |
280 } // namespace cc | 282 } // namespace cc |
281 | 283 |
282 #endif | 284 #endif |
OLD | NEW |