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