| 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 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/layer_tree_host.h" | 7 #include "cc/layer_tree_host.h" |
| 8 | 8 |
| 9 #include "CCFontAtlas.h" | 9 #include "CCFontAtlas.h" |
| 10 #include "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 RendererCapabilities::~RendererCapabilities() | 76 RendererCapabilities::~RendererCapabilities() |
| 77 { | 77 { |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool LayerTreeHost::anyLayerTreeHostInstanceExists() | 80 bool LayerTreeHost::anyLayerTreeHostInstanceExists() |
| 81 { | 81 { |
| 82 return numLayerTreeInstances > 0; | 82 return numLayerTreeInstances > 0; |
| 83 } | 83 } |
| 84 | 84 |
| 85 scoped_ptr<LayerTreeHost> LayerTreeHost::create(LayerTreeHostClient* client, con
st LayerTreeSettings& settings) | 85 scoped_ptr<LayerTreeHost> LayerTreeHost::create(LayerTreeHostClient* client, con
st LayerTreeSettings& settings, Thread* implThread) |
| 86 { | 86 { |
| 87 scoped_ptr<LayerTreeHost> layerTreeHost(new LayerTreeHost(client, settings))
; | 87 scoped_ptr<LayerTreeHost> layerTreeHost(new LayerTreeHost(client, settings))
; |
| 88 if (!layerTreeHost->initialize()) | 88 if (!layerTreeHost->initialize(implThread)) |
| 89 return scoped_ptr<LayerTreeHost>(); | 89 return scoped_ptr<LayerTreeHost>(); |
| 90 return layerTreeHost.Pass(); | 90 return layerTreeHost.Pass(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting
s& settings) | 93 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting
s& settings) |
| 94 : m_animating(false) | 94 : m_animating(false) |
| 95 , m_needsAnimateLayers(false) | 95 , m_needsAnimateLayers(false) |
| 96 , m_client(client) | 96 , m_client(client) |
| 97 , m_commitNumber(0) | 97 , m_commitNumber(0) |
| 98 , m_renderingStats() | 98 , m_renderingStats() |
| 99 , m_rendererInitialized(false) | 99 , m_rendererInitialized(false) |
| 100 , m_contextLost(false) | 100 , m_contextLost(false) |
| 101 , m_numTimesRecreateShouldFail(0) | 101 , m_numTimesRecreateShouldFail(0) |
| 102 , m_numFailedRecreateAttempts(0) | 102 , m_numFailedRecreateAttempts(0) |
| 103 , m_settings(settings) | 103 , m_settings(settings) |
| 104 , m_deviceScaleFactor(1) | 104 , m_deviceScaleFactor(1) |
| 105 , m_visible(true) | 105 , m_visible(true) |
| 106 , m_pageScaleFactor(1) | 106 , m_pageScaleFactor(1) |
| 107 , m_minPageScaleFactor(1) | 107 , m_minPageScaleFactor(1) |
| 108 , m_maxPageScaleFactor(1) | 108 , m_maxPageScaleFactor(1) |
| 109 , m_triggerIdleUpdates(true) | 109 , m_triggerIdleUpdates(true) |
| 110 , m_backgroundColor(SK_ColorWHITE) | 110 , m_backgroundColor(SK_ColorWHITE) |
| 111 , m_hasTransparentBackground(false) | 111 , m_hasTransparentBackground(false) |
| 112 , m_partialTextureUpdateRequests(0) | 112 , m_partialTextureUpdateRequests(0) |
| 113 { | 113 { |
| 114 DCHECK(Proxy::isMainThread()); | |
| 115 numLayerTreeInstances++; | 114 numLayerTreeInstances++; |
| 116 } | 115 } |
| 117 | 116 |
| 118 bool LayerTreeHost::initialize() | 117 bool LayerTreeHost::initialize(Thread* implThread) |
| 119 { | 118 { |
| 120 TRACE_EVENT0("cc", "LayerTreeHost::initialize"); | 119 TRACE_EVENT0("cc", "LayerTreeHost::initialize"); |
| 121 | 120 |
| 122 if (Proxy::hasImplThread()) | 121 if (implThread) |
| 123 m_proxy = ThreadProxy::create(this); | 122 m_proxy = ThreadProxy::create(this, implThread); |
| 124 else | 123 else |
| 125 m_proxy = SingleThreadProxy::create(this); | 124 m_proxy = SingleThreadProxy::create(this); |
| 126 m_proxy->start(); | 125 m_proxy->start(); |
| 127 | 126 |
| 128 return m_proxy->initializeContext(); | 127 return m_proxy->initializeContext(); |
| 129 } | 128 } |
| 130 | 129 |
| 131 LayerTreeHost::~LayerTreeHost() | 130 LayerTreeHost::~LayerTreeHost() |
| 132 { | 131 { |
| 133 if (m_rootLayer) | 132 if (m_rootLayer) |
| 134 m_rootLayer->setLayerTreeHost(0); | 133 m_rootLayer->setLayerTreeHost(0); |
| 135 DCHECK(Proxy::isMainThread()); | 134 DCHECK(m_proxy.get()); |
| 135 DCHECK(m_proxy->isMainThread()); |
| 136 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); | 136 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); |
| 137 DCHECK(m_proxy.get()); | |
| 138 m_proxy->stop(); | 137 m_proxy->stop(); |
| 139 m_proxy.reset(); | |
| 140 numLayerTreeInstances--; | 138 numLayerTreeInstances--; |
| 141 RateLimiterMap::iterator it = m_rateLimiters.begin(); | 139 RateLimiterMap::iterator it = m_rateLimiters.begin(); |
| 142 if (it != m_rateLimiters.end()) | 140 if (it != m_rateLimiters.end()) |
| 143 it->second->stop(); | 141 it->second->stop(); |
| 144 } | 142 } |
| 145 | 143 |
| 146 void LayerTreeHost::setSurfaceReady() | 144 void LayerTreeHost::setSurfaceReady() |
| 147 { | 145 { |
| 148 m_proxy->setSurfaceReady(); | 146 m_proxy->setSurfaceReady(); |
| 149 } | 147 } |
| 150 | 148 |
| 151 void LayerTreeHost::initializeRenderer() | 149 void LayerTreeHost::initializeRenderer() |
| 152 { | 150 { |
| 153 TRACE_EVENT0("cc", "LayerTreeHost::initializeRenderer"); | 151 TRACE_EVENT0("cc", "LayerTreeHost::initializeRenderer"); |
| 154 if (!m_proxy->initializeRenderer()) { | 152 if (!m_proxy->initializeRenderer()) { |
| 155 // Uh oh, better tell the client that we can't do anything with this con
text. | 153 // Uh oh, better tell the client that we can't do anything with this con
text. |
| 156 m_client->didRecreateOutputSurface(false); | 154 m_client->didRecreateOutputSurface(false); |
| 157 return; | 155 return; |
| 158 } | 156 } |
| 159 | 157 |
| 160 // Update m_settings based on capabilities that we got back from the rendere
r. | 158 // Update m_settings based on capabilities that we got back from the rendere
r. |
| 161 m_settings.acceleratePainting = m_proxy->rendererCapabilities().usingAcceler
atedPainting; | 159 m_settings.acceleratePainting = m_proxy->rendererCapabilities().usingAcceler
atedPainting; |
| 162 | 160 |
| 163 // Update m_settings based on partial update capability. | 161 // Update m_settings based on partial update capability. |
| 164 m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdate
s, m_proxy->maxPartialTextureUpdates()); | 162 m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdate
s, m_proxy->maxPartialTextureUpdates()); |
| 165 | 163 |
| 166 m_contentsTextureManager = PrioritizedTextureManager::create(0, m_proxy->ren
dererCapabilities().maxTextureSize, Renderer::ContentPool); | 164 m_contentsTextureManager = PrioritizedTextureManager::create(0, m_proxy->ren
dererCapabilities().maxTextureSize, Renderer::ContentPool, m_proxy.get()); |
| 167 m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize
(), GL_RGBA); | 165 m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize
(), GL_RGBA); |
| 168 | 166 |
| 169 m_rendererInitialized = true; | 167 m_rendererInitialized = true; |
| 170 | 168 |
| 171 m_settings.defaultTileSize = IntSize(min(m_settings.defaultTileSize.width(),
m_proxy->rendererCapabilities().maxTextureSize), | 169 m_settings.defaultTileSize = IntSize(min(m_settings.defaultTileSize.width(),
m_proxy->rendererCapabilities().maxTextureSize), |
| 172 min(m_settings.defaultTileSize.height()
, m_proxy->rendererCapabilities().maxTextureSize)); | 170 min(m_settings.defaultTileSize.height()
, m_proxy->rendererCapabilities().maxTextureSize)); |
| 173 m_settings.maxUntiledLayerSize = IntSize(min(m_settings.maxUntiledLayerSize.
width(), m_proxy->rendererCapabilities().maxTextureSize), | 171 m_settings.maxUntiledLayerSize = IntSize(min(m_settings.maxUntiledLayerSize.
width(), m_proxy->rendererCapabilities().maxTextureSize), |
| 174 min(m_settings.maxUntiledLayerSize.
height(), m_proxy->rendererCapabilities().maxTextureSize)); | 172 min(m_settings.maxUntiledLayerSize.
height(), m_proxy->rendererCapabilities().maxTextureSize)); |
| 175 } | 173 } |
| 176 | 174 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 191 return RecreateSucceeded; | 189 return RecreateSucceeded; |
| 192 } | 190 } |
| 193 | 191 |
| 194 // Tolerate a certain number of recreation failures to work around races | 192 // Tolerate a certain number of recreation failures to work around races |
| 195 // in the context-lost machinery. | 193 // in the context-lost machinery. |
| 196 m_numFailedRecreateAttempts++; | 194 m_numFailedRecreateAttempts++; |
| 197 if (m_numFailedRecreateAttempts < 5) { | 195 if (m_numFailedRecreateAttempts < 5) { |
| 198 // FIXME: The single thread does not self-schedule context | 196 // FIXME: The single thread does not self-schedule context |
| 199 // recreation. So force another recreation attempt to happen by requesti
ng | 197 // recreation. So force another recreation attempt to happen by requesti
ng |
| 200 // another commit. | 198 // another commit. |
| 201 if (!Proxy::hasImplThread()) | 199 if (!m_proxy->hasImplThread()) |
| 202 setNeedsCommit(); | 200 setNeedsCommit(); |
| 203 return RecreateFailedButTryAgain; | 201 return RecreateFailedButTryAgain; |
| 204 } | 202 } |
| 205 | 203 |
| 206 // We have tried too many times to recreate the context. Tell the host to fa
ll | 204 // We have tried too many times to recreate the context. Tell the host to fa
ll |
| 207 // back to software rendering. | 205 // back to software rendering. |
| 208 m_client->didRecreateOutputSurface(false); | 206 m_client->didRecreateOutputSurface(false); |
| 209 return RecreateFailedAndGaveUp; | 207 return RecreateFailedAndGaveUp; |
| 210 } | 208 } |
| 211 | 209 |
| 212 void LayerTreeHost::deleteContentsTexturesOnImplThread(ResourceProvider* resourc
eProvider) | 210 void LayerTreeHost::deleteContentsTexturesOnImplThread(ResourceProvider* resourc
eProvider) |
| 213 { | 211 { |
| 214 DCHECK(Proxy::isImplThread()); | 212 DCHECK(m_proxy->isImplThread()); |
| 215 if (m_rendererInitialized) | 213 if (m_rendererInitialized) |
| 216 m_contentsTextureManager->clearAllMemory(resourceProvider); | 214 m_contentsTextureManager->clearAllMemory(resourceProvider); |
| 217 } | 215 } |
| 218 | 216 |
| 219 void LayerTreeHost::acquireLayerTextures() | 217 void LayerTreeHost::acquireLayerTextures() |
| 220 { | 218 { |
| 221 DCHECK(Proxy::isMainThread()); | 219 DCHECK(m_proxy->isMainThread()); |
| 222 m_proxy->acquireLayerTextures(); | 220 m_proxy->acquireLayerTextures(); |
| 223 } | 221 } |
| 224 | 222 |
| 225 void LayerTreeHost::updateAnimations(double monotonicFrameBeginTime) | 223 void LayerTreeHost::updateAnimations(double monotonicFrameBeginTime) |
| 226 { | 224 { |
| 227 m_animating = true; | 225 m_animating = true; |
| 228 m_client->animate(monotonicFrameBeginTime); | 226 m_client->animate(monotonicFrameBeginTime); |
| 229 animateLayers(monotonicFrameBeginTime); | 227 animateLayers(monotonicFrameBeginTime); |
| 230 m_animating = false; | 228 m_animating = false; |
| 231 | 229 |
| 232 m_renderingStats.numAnimationFrames++; | 230 m_renderingStats.numAnimationFrames++; |
| 233 } | 231 } |
| 234 | 232 |
| 235 void LayerTreeHost::layout() | 233 void LayerTreeHost::layout() |
| 236 { | 234 { |
| 237 m_client->layout(); | 235 m_client->layout(); |
| 238 } | 236 } |
| 239 | 237 |
| 240 void LayerTreeHost::beginCommitOnImplThread(LayerTreeHostImpl* hostImpl) | 238 void LayerTreeHost::beginCommitOnImplThread(LayerTreeHostImpl* hostImpl) |
| 241 { | 239 { |
| 242 DCHECK(Proxy::isImplThread()); | 240 DCHECK(m_proxy->isImplThread()); |
| 243 TRACE_EVENT0("cc", "LayerTreeHost::commitTo"); | 241 TRACE_EVENT0("cc", "LayerTreeHost::commitTo"); |
| 244 } | 242 } |
| 245 | 243 |
| 246 // This function commits the LayerTreeHost to an impl tree. When modifying | 244 // This function commits the LayerTreeHost to an impl tree. When modifying |
| 247 // this function, keep in mind that the function *runs* on the impl thread! Any | 245 // this function, keep in mind that the function *runs* on the impl thread! Any |
| 248 // code that is logically a main thread operation, e.g. deletion of a Layer, | 246 // code that is logically a main thread operation, e.g. deletion of a Layer, |
| 249 // should be delayed until the LayerTreeHost::commitComplete, which will run | 247 // should be delayed until the LayerTreeHost::commitComplete, which will run |
| 250 // after the commit, but on the main thread. | 248 // after the commit, but on the main thread. |
| 251 void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl) | 249 void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl) |
| 252 { | 250 { |
| 253 DCHECK(Proxy::isImplThread()); | 251 DCHECK(m_proxy->isImplThread()); |
| 254 | 252 |
| 255 m_contentsTextureManager->updateBackingsInDrawingImplTree(); | 253 m_contentsTextureManager->updateBackingsInDrawingImplTree(); |
| 256 m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); | 254 m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); |
| 257 | 255 |
| 258 hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostI
mpl->detachLayerTree(), hostImpl)); | 256 hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostI
mpl->detachLayerTree(), hostImpl)); |
| 259 | 257 |
| 260 if (m_rootLayer && m_hudLayer) | 258 if (m_rootLayer && m_hudLayer) |
| 261 hostImpl->setHudLayer(static_cast<HeadsUpDisplayLayerImpl*>(LayerTreeHos
tCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id()))); | 259 hostImpl->setHudLayer(static_cast<HeadsUpDisplayLayerImpl*>(LayerTreeHos
tCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id()))); |
| 262 else | 260 else |
| 263 hostImpl->setHudLayer(0); | 261 hostImpl->setHudLayer(0); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 return m_client->createOutputSurface(); | 307 return m_client->createOutputSurface(); |
| 310 } | 308 } |
| 311 | 309 |
| 312 scoped_ptr<InputHandler> LayerTreeHost::createInputHandler() | 310 scoped_ptr<InputHandler> LayerTreeHost::createInputHandler() |
| 313 { | 311 { |
| 314 return m_client->createInputHandler(); | 312 return m_client->createInputHandler(); |
| 315 } | 313 } |
| 316 | 314 |
| 317 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::createLayerTreeHostImpl(LayerTreeHo
stImplClient* client) | 315 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::createLayerTreeHostImpl(LayerTreeHo
stImplClient* client) |
| 318 { | 316 { |
| 319 return LayerTreeHostImpl::create(m_settings, client); | 317 return LayerTreeHostImpl::create(m_settings, client, m_proxy.get()); |
| 320 } | 318 } |
| 321 | 319 |
| 322 void LayerTreeHost::didLoseContext() | 320 void LayerTreeHost::didLoseContext() |
| 323 { | 321 { |
| 324 TRACE_EVENT0("cc", "LayerTreeHost::didLoseContext"); | 322 TRACE_EVENT0("cc", "LayerTreeHost::didLoseContext"); |
| 325 DCHECK(Proxy::isMainThread()); | 323 DCHECK(m_proxy->isMainThread()); |
| 326 m_contextLost = true; | 324 m_contextLost = true; |
| 327 m_numFailedRecreateAttempts = 0; | 325 m_numFailedRecreateAttempts = 0; |
| 328 setNeedsCommit(); | 326 setNeedsCommit(); |
| 329 } | 327 } |
| 330 | 328 |
| 331 bool LayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) | 329 bool LayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) |
| 332 { | 330 { |
| 333 m_triggerIdleUpdates = false; | 331 m_triggerIdleUpdates = false; |
| 334 bool ret = m_proxy->compositeAndReadback(pixels, rect); | 332 bool ret = m_proxy->compositeAndReadback(pixels, rect); |
| 335 m_triggerIdleUpdates = true; | 333 m_triggerIdleUpdates = true; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 349 m_proxy->renderingStats(stats); | 347 m_proxy->renderingStats(stats); |
| 350 } | 348 } |
| 351 | 349 |
| 352 const RendererCapabilities& LayerTreeHost::rendererCapabilities() const | 350 const RendererCapabilities& LayerTreeHost::rendererCapabilities() const |
| 353 { | 351 { |
| 354 return m_proxy->rendererCapabilities(); | 352 return m_proxy->rendererCapabilities(); |
| 355 } | 353 } |
| 356 | 354 |
| 357 void LayerTreeHost::setNeedsAnimate() | 355 void LayerTreeHost::setNeedsAnimate() |
| 358 { | 356 { |
| 359 DCHECK(Proxy::hasImplThread()); | 357 DCHECK(m_proxy->hasImplThread()); |
| 360 m_proxy->setNeedsAnimate(); | 358 m_proxy->setNeedsAnimate(); |
| 361 } | 359 } |
| 362 | 360 |
| 363 void LayerTreeHost::setNeedsCommit() | 361 void LayerTreeHost::setNeedsCommit() |
| 364 { | 362 { |
| 365 m_proxy->setNeedsCommit(); | 363 m_proxy->setNeedsCommit(); |
| 366 } | 364 } |
| 367 | 365 |
| 368 void LayerTreeHost::setNeedsRedraw() | 366 void LayerTreeHost::setNeedsRedraw() |
| 369 { | 367 { |
| 370 m_proxy->setNeedsRedraw(); | 368 m_proxy->setNeedsRedraw(); |
| 371 if (!ThreadProxy::implThread()) | 369 if (!m_proxy->implThread()) |
| 372 m_client->scheduleComposite(); | 370 m_client->scheduleComposite(); |
| 373 } | 371 } |
| 374 | 372 |
| 375 bool LayerTreeHost::commitRequested() const | 373 bool LayerTreeHost::commitRequested() const |
| 376 { | 374 { |
| 377 return m_proxy->commitRequested(); | 375 return m_proxy->commitRequested(); |
| 378 } | 376 } |
| 379 | 377 |
| 380 void LayerTreeHost::setAnimationEvents(scoped_ptr<AnimationEventsVector> events,
double wallClockTime) | 378 void LayerTreeHost::setAnimationEvents(scoped_ptr<AnimationEventsVector> events,
double wallClockTime) |
| 381 { | 379 { |
| 382 DCHECK(ThreadProxy::isMainThread()); | 380 DCHECK(m_proxy->isMainThread()); |
| 383 setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime)
; | 381 setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime)
; |
| 384 } | 382 } |
| 385 | 383 |
| 386 void LayerTreeHost::didAddAnimation() | 384 void LayerTreeHost::didAddAnimation() |
| 387 { | 385 { |
| 388 m_needsAnimateLayers = true; | 386 m_needsAnimateLayers = true; |
| 389 m_proxy->didAddAnimation(); | 387 m_proxy->didAddAnimation(); |
| 390 } | 388 } |
| 391 | 389 |
| 392 void LayerTreeHost::setRootLayer(scoped_refptr<Layer> rootLayer) | 390 void LayerTreeHost::setRootLayer(scoped_refptr<Layer> rootLayer) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 m_proxy->loseContext(); | 446 m_proxy->loseContext(); |
| 449 } | 447 } |
| 450 | 448 |
| 451 PrioritizedTextureManager* LayerTreeHost::contentsTextureManager() const | 449 PrioritizedTextureManager* LayerTreeHost::contentsTextureManager() const |
| 452 { | 450 { |
| 453 return m_contentsTextureManager.get(); | 451 return m_contentsTextureManager.get(); |
| 454 } | 452 } |
| 455 | 453 |
| 456 void LayerTreeHost::composite() | 454 void LayerTreeHost::composite() |
| 457 { | 455 { |
| 458 DCHECK(!ThreadProxy::implThread()); | 456 DCHECK(!m_proxy->implThread()); |
| 459 static_cast<SingleThreadProxy*>(m_proxy.get())->compositeImmediately(); | 457 static_cast<SingleThreadProxy*>(m_proxy.get())->compositeImmediately(); |
| 460 } | 458 } |
| 461 | 459 |
| 462 void LayerTreeHost::scheduleComposite() | 460 void LayerTreeHost::scheduleComposite() |
| 463 { | 461 { |
| 464 m_client->scheduleComposite(); | 462 m_client->scheduleComposite(); |
| 465 } | 463 } |
| 466 | 464 |
| 467 bool LayerTreeHost::initializeRendererIfNeeded() | 465 bool LayerTreeHost::initializeRendererIfNeeded() |
| 468 { | 466 { |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 void LayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) | 716 void LayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) |
| 719 { | 717 { |
| 720 if (m_animating) | 718 if (m_animating) |
| 721 return; | 719 return; |
| 722 | 720 |
| 723 DCHECK(context); | 721 DCHECK(context); |
| 724 RateLimiterMap::iterator it = m_rateLimiters.find(context); | 722 RateLimiterMap::iterator it = m_rateLimiters.find(context); |
| 725 if (it != m_rateLimiters.end()) | 723 if (it != m_rateLimiters.end()) |
| 726 it->second->start(); | 724 it->second->start(); |
| 727 else { | 725 else { |
| 728 scoped_refptr<RateLimiter> rateLimiter = RateLimiter::create(context, th
is); | 726 scoped_refptr<RateLimiter> rateLimiter = RateLimiter::create(context, th
is, m_proxy.get()); |
| 729 m_rateLimiters[context] = rateLimiter; | 727 m_rateLimiters[context] = rateLimiter; |
| 730 rateLimiter->start(); | 728 rateLimiter->start(); |
| 731 } | 729 } |
| 732 } | 730 } |
| 733 | 731 |
| 734 void LayerTreeHost::stopRateLimiter(WebKit::WebGraphicsContext3D* context) | 732 void LayerTreeHost::stopRateLimiter(WebKit::WebGraphicsContext3D* context) |
| 735 { | 733 { |
| 736 RateLimiterMap::iterator it = m_rateLimiters.find(context); | 734 RateLimiterMap::iterator it = m_rateLimiters.find(context); |
| 737 if (it != m_rateLimiters.end()) { | 735 if (it != m_rateLimiters.end()) { |
| 738 it->second->stop(); | 736 it->second->stop(); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 else | 815 else |
| 818 layer->notifyAnimationFinished(wallClockTime); | 816 layer->notifyAnimationFinished(wallClockTime); |
| 819 } | 817 } |
| 820 } | 818 } |
| 821 | 819 |
| 822 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 820 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 823 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 821 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 824 } | 822 } |
| 825 | 823 |
| 826 } // namespace cc | 824 } // namespace cc |
| OLD | NEW |