| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/hash_tables.h" |
| 9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "cc/own_ptr_vector.h" | |
| 12 #include "CCAnimationEvents.h" | 12 #include "CCAnimationEvents.h" |
| 13 #include "CCGraphicsContext.h" | 13 #include "CCGraphicsContext.h" |
| 14 #include "CCLayerTreeHostClient.h" | 14 #include "CCLayerTreeHostClient.h" |
| 15 #include "CCLayerTreeHostCommon.h" | 15 #include "CCLayerTreeHostCommon.h" |
| 16 #include "CCOcclusionTracker.h" | 16 #include "CCOcclusionTracker.h" |
| 17 #include "CCPrioritizedTextureManager.h" | 17 #include "CCPrioritizedTextureManager.h" |
| 18 #include "CCProxy.h" | 18 #include "CCProxy.h" |
| 19 #include "CCRenderingStats.h" | 19 #include "CCRenderingStats.h" |
| 20 #include "IntRect.h" | 20 #include "IntRect.h" |
| 21 #include "RateLimiter.h" | 21 #include "RateLimiter.h" |
| 22 #include "scoped_ptr_vector.h" |
| 22 #include "SkColor.h" | 23 #include "SkColor.h" |
| 23 #include <limits> | 24 #include <limits> |
| 24 #include <wtf/HashMap.h> | 25 |
| 25 #include <wtf/OwnPtr.h> | 26 #if defined(COMPILER_GCC) |
| 26 #include <wtf/PassOwnPtr.h> | 27 namespace BASE_HASH_NAMESPACE { |
| 28 template<> |
| 29 struct hash<WebKit::WebGraphicsContext3D*> { |
| 30 size_t operator()(WebKit::WebGraphicsContext3D* ptr) const { |
| 31 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
| 32 } |
| 33 }; |
| 34 } // namespace BASE_HASH_NAMESPACE |
| 35 #endif // COMPILER |
| 27 | 36 |
| 28 namespace cc { | 37 namespace cc { |
| 29 | 38 |
| 30 class CCFontAtlas; | 39 class CCFontAtlas; |
| 31 class CCLayerChromium; | 40 class CCLayerChromium; |
| 32 class CCLayerTreeHostImpl; | 41 class CCLayerTreeHostImpl; |
| 33 class CCLayerTreeHostImplClient; | 42 class CCLayerTreeHostImplClient; |
| 34 class CCPrioritizedTextureManager; | 43 class CCPrioritizedTextureManager; |
| 35 class CCTextureUpdateQueue; | 44 class CCTextureUpdateQueue; |
| 36 class HeadsUpDisplayLayerChromium; | 45 class HeadsUpDisplayLayerChromium; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 149 |
| 141 // Test only hook | 150 // Test only hook |
| 142 void loseContext(int numTimes); | 151 void loseContext(int numTimes); |
| 143 | 152 |
| 144 void setNeedsAnimate(); | 153 void setNeedsAnimate(); |
| 145 // virtual for testing | 154 // virtual for testing |
| 146 virtual void setNeedsCommit(); | 155 virtual void setNeedsCommit(); |
| 147 void setNeedsRedraw(); | 156 void setNeedsRedraw(); |
| 148 bool commitRequested() const; | 157 bool commitRequested() const; |
| 149 | 158 |
| 150 void setAnimationEvents(PassOwnPtr<CCAnimationEventsVector>, double wallCloc
kTime); | 159 void setAnimationEvents(scoped_ptr<CCAnimationEventsVector>, double wallCloc
kTime); |
| 151 virtual void didAddAnimation(); | 160 virtual void didAddAnimation(); |
| 152 | 161 |
| 153 LayerChromium* rootLayer() { return m_rootLayer.get(); } | 162 LayerChromium* rootLayer() { return m_rootLayer.get(); } |
| 154 const LayerChromium* rootLayer() const { return m_rootLayer.get(); } | 163 const LayerChromium* rootLayer() const { return m_rootLayer.get(); } |
| 155 void setRootLayer(scoped_refptr<LayerChromium>); | 164 void setRootLayer(scoped_refptr<LayerChromium>); |
| 156 | 165 |
| 157 const CCLayerTreeSettings& settings() const { return m_settings; } | 166 const CCLayerTreeSettings& settings() const { return m_settings; } |
| 158 | 167 |
| 159 void setViewportSize(const IntSize& layoutViewportSize, const IntSize& devic
eViewportSize); | 168 void setViewportSize(const IntSize& layoutViewportSize, const IntSize& devic
eViewportSize); |
| 160 | 169 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 void setImplTransform(const WebKit::WebTransformationMatrix&); | 203 void setImplTransform(const WebKit::WebTransformationMatrix&); |
| 195 | 204 |
| 196 void startRateLimiter(WebKit::WebGraphicsContext3D*); | 205 void startRateLimiter(WebKit::WebGraphicsContext3D*); |
| 197 void stopRateLimiter(WebKit::WebGraphicsContext3D*); | 206 void stopRateLimiter(WebKit::WebGraphicsContext3D*); |
| 198 | 207 |
| 199 // RateLimitClient implementation | 208 // RateLimitClient implementation |
| 200 virtual void rateLimit() OVERRIDE; | 209 virtual void rateLimit() OVERRIDE; |
| 201 | 210 |
| 202 bool bufferedUpdates(); | 211 bool bufferedUpdates(); |
| 203 bool requestPartialTextureUpdate(); | 212 bool requestPartialTextureUpdate(); |
| 204 void deleteTextureAfterCommit(PassOwnPtr<CCPrioritizedTexture>); | 213 void deleteTextureAfterCommit(scoped_ptr<CCPrioritizedTexture>); |
| 205 | 214 |
| 206 void setDeviceScaleFactor(float); | 215 void setDeviceScaleFactor(float); |
| 207 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 216 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
| 208 | 217 |
| 209 void setFontAtlas(scoped_ptr<CCFontAtlas>); | 218 void setFontAtlas(scoped_ptr<CCFontAtlas>); |
| 210 | 219 |
| 211 HeadsUpDisplayLayerChromium* hudLayer() const { return m_hudLayer.get(); } | 220 HeadsUpDisplayLayerChromium* hudLayer() const { return m_hudLayer.get(); } |
| 212 | 221 |
| 213 protected: | 222 protected: |
| 214 CCLayerTreeHost(CCLayerTreeHostClient*, const CCLayerTreeSettings&); | 223 CCLayerTreeHost(CCLayerTreeHostClient*, const CCLayerTreeSettings&); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 235 void setAnimationEventsRecursive(const CCAnimationEventsVector&, LayerChromi
um*, double wallClockTime); | 244 void setAnimationEventsRecursive(const CCAnimationEventsVector&, LayerChromi
um*, double wallClockTime); |
| 236 | 245 |
| 237 bool m_animating; | 246 bool m_animating; |
| 238 bool m_needsAnimateLayers; | 247 bool m_needsAnimateLayers; |
| 239 | 248 |
| 240 CCLayerTreeHostClient* m_client; | 249 CCLayerTreeHostClient* m_client; |
| 241 | 250 |
| 242 int m_commitNumber; | 251 int m_commitNumber; |
| 243 CCRenderingStats m_renderingStats; | 252 CCRenderingStats m_renderingStats; |
| 244 | 253 |
| 245 OwnPtr<CCProxy> m_proxy; | 254 scoped_ptr<CCProxy> m_proxy; |
| 246 bool m_rendererInitialized; | 255 bool m_rendererInitialized; |
| 247 bool m_contextLost; | 256 bool m_contextLost; |
| 248 int m_numTimesRecreateShouldFail; | 257 int m_numTimesRecreateShouldFail; |
| 249 int m_numFailedRecreateAttempts; | 258 int m_numFailedRecreateAttempts; |
| 250 | 259 |
| 251 scoped_refptr<LayerChromium> m_rootLayer; | 260 scoped_refptr<LayerChromium> m_rootLayer; |
| 252 scoped_refptr<HeadsUpDisplayLayerChromium> m_hudLayer; | 261 scoped_refptr<HeadsUpDisplayLayerChromium> m_hudLayer; |
| 253 scoped_ptr<CCFontAtlas> m_fontAtlas; | 262 scoped_ptr<CCFontAtlas> m_fontAtlas; |
| 254 | 263 |
| 255 OwnPtr<CCPrioritizedTextureManager> m_contentsTextureManager; | 264 scoped_ptr<CCPrioritizedTextureManager> m_contentsTextureManager; |
| 256 OwnPtr<CCPrioritizedTexture> m_surfaceMemoryPlaceholder; | 265 scoped_ptr<CCPrioritizedTexture> m_surfaceMemoryPlaceholder; |
| 257 | 266 |
| 258 CCLayerTreeSettings m_settings; | 267 CCLayerTreeSettings m_settings; |
| 259 | 268 |
| 260 IntSize m_layoutViewportSize; | 269 IntSize m_layoutViewportSize; |
| 261 IntSize m_deviceViewportSize; | 270 IntSize m_deviceViewportSize; |
| 262 float m_deviceScaleFactor; | 271 float m_deviceScaleFactor; |
| 263 | 272 |
| 264 bool m_visible; | 273 bool m_visible; |
| 265 | 274 |
| 266 typedef HashMap<WebKit::WebGraphicsContext3D*, RefPtr<RateLimiter> > RateLim
iterMap; | 275 typedef base::hash_map<WebKit::WebGraphicsContext3D*, scoped_refptr<RateLimi
ter> > RateLimiterMap; |
| 267 RateLimiterMap m_rateLimiters; | 276 RateLimiterMap m_rateLimiters; |
| 268 | 277 |
| 269 float m_pageScaleFactor; | 278 float m_pageScaleFactor; |
| 270 float m_minPageScaleFactor, m_maxPageScaleFactor; | 279 float m_minPageScaleFactor, m_maxPageScaleFactor; |
| 271 WebKit::WebTransformationMatrix m_implTransform; | 280 WebKit::WebTransformationMatrix m_implTransform; |
| 272 bool m_triggerIdleUpdates; | 281 bool m_triggerIdleUpdates; |
| 273 | 282 |
| 274 SkColor m_backgroundColor; | 283 SkColor m_backgroundColor; |
| 275 bool m_hasTransparentBackground; | 284 bool m_hasTransparentBackground; |
| 276 | 285 |
| 277 typedef OwnPtrVector<CCPrioritizedTexture> TextureList; | 286 typedef ScopedPtrVector<CCPrioritizedTexture> TextureList; |
| 278 TextureList m_deleteTextureAfterCommitList; | 287 TextureList m_deleteTextureAfterCommitList; |
| 279 size_t m_partialTextureUpdateRequests; | 288 size_t m_partialTextureUpdateRequests; |
| 280 | 289 |
| 281 static bool s_needsFilterContext; | 290 static bool s_needsFilterContext; |
| 282 | 291 |
| 283 DISALLOW_COPY_AND_ASSIGN(CCLayerTreeHost); | 292 DISALLOW_COPY_AND_ASSIGN(CCLayerTreeHost); |
| 284 }; | 293 }; |
| 285 | 294 |
| 286 } // namespace cc | 295 } // namespace cc |
| 287 | 296 |
| 288 #endif | 297 #endif |
| OLD | NEW |