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