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 "CCLayerTreeHost.h" | 7 #include "CCLayerTreeHost.h" |
8 | 8 |
9 #include "CCFontAtlas.h" | 9 #include "CCFontAtlas.h" |
10 #include "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ASSERT(CCProxy::isMainThread()); | 114 DCHECK(CCProxy::isMainThread()); |
115 numLayerTreeInstances++; | 115 numLayerTreeInstances++; |
116 } | 116 } |
117 | 117 |
118 bool CCLayerTreeHost::initialize() | 118 bool CCLayerTreeHost::initialize() |
119 { | 119 { |
120 TRACE_EVENT0("cc", "CCLayerTreeHost::initialize"); | 120 TRACE_EVENT0("cc", "CCLayerTreeHost::initialize"); |
121 | 121 |
122 if (CCProxy::hasImplThread()) | 122 if (CCProxy::hasImplThread()) |
123 m_proxy = CCThreadProxy::create(this); | 123 m_proxy = CCThreadProxy::create(this); |
124 else | 124 else |
125 m_proxy = CCSingleThreadProxy::create(this); | 125 m_proxy = CCSingleThreadProxy::create(this); |
126 m_proxy->start(); | 126 m_proxy->start(); |
127 | 127 |
128 return m_proxy->initializeContext(); | 128 return m_proxy->initializeContext(); |
129 } | 129 } |
130 | 130 |
131 CCLayerTreeHost::~CCLayerTreeHost() | 131 CCLayerTreeHost::~CCLayerTreeHost() |
132 { | 132 { |
133 if (m_rootLayer) | 133 if (m_rootLayer) |
134 m_rootLayer->setLayerTreeHost(0); | 134 m_rootLayer->setLayerTreeHost(0); |
135 ASSERT(CCProxy::isMainThread()); | 135 DCHECK(CCProxy::isMainThread()); |
136 TRACE_EVENT0("cc", "CCLayerTreeHost::~CCLayerTreeHost"); | 136 TRACE_EVENT0("cc", "CCLayerTreeHost::~CCLayerTreeHost"); |
137 ASSERT(m_proxy.get()); | 137 DCHECK(m_proxy.get()); |
138 m_proxy->stop(); | 138 m_proxy->stop(); |
139 m_proxy.reset(); | 139 m_proxy.reset(); |
140 numLayerTreeInstances--; | 140 numLayerTreeInstances--; |
141 RateLimiterMap::iterator it = m_rateLimiters.begin(); | 141 RateLimiterMap::iterator it = m_rateLimiters.begin(); |
142 if (it != m_rateLimiters.end()) | 142 if (it != m_rateLimiters.end()) |
143 it->second->stop(); | 143 it->second->stop(); |
144 } | 144 } |
145 | 145 |
146 void CCLayerTreeHost::setSurfaceReady() | 146 void CCLayerTreeHost::setSurfaceReady() |
147 { | 147 { |
(...skipping 22 matching lines...) Expand all Loading... |
170 | 170 |
171 m_settings.defaultTileSize = IntSize(min(m_settings.defaultTileSize.width(),
m_proxy->rendererCapabilities().maxTextureSize), | 171 m_settings.defaultTileSize = IntSize(min(m_settings.defaultTileSize.width(),
m_proxy->rendererCapabilities().maxTextureSize), |
172 min(m_settings.defaultTileSize.height()
, m_proxy->rendererCapabilities().maxTextureSize)); | 172 min(m_settings.defaultTileSize.height()
, m_proxy->rendererCapabilities().maxTextureSize)); |
173 m_settings.maxUntiledLayerSize = IntSize(min(m_settings.maxUntiledLayerSize.
width(), m_proxy->rendererCapabilities().maxTextureSize), | 173 m_settings.maxUntiledLayerSize = IntSize(min(m_settings.maxUntiledLayerSize.
width(), m_proxy->rendererCapabilities().maxTextureSize), |
174 min(m_settings.maxUntiledLayerSize.
height(), m_proxy->rendererCapabilities().maxTextureSize)); | 174 min(m_settings.maxUntiledLayerSize.
height(), m_proxy->rendererCapabilities().maxTextureSize)); |
175 } | 175 } |
176 | 176 |
177 CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext() | 177 CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext() |
178 { | 178 { |
179 TRACE_EVENT0("cc", "CCLayerTreeHost::recreateContext"); | 179 TRACE_EVENT0("cc", "CCLayerTreeHost::recreateContext"); |
180 ASSERT(m_contextLost); | 180 DCHECK(m_contextLost); |
181 | 181 |
182 bool recreated = false; | 182 bool recreated = false; |
183 if (!m_numTimesRecreateShouldFail) | 183 if (!m_numTimesRecreateShouldFail) |
184 recreated = m_proxy->recreateContext(); | 184 recreated = m_proxy->recreateContext(); |
185 else | 185 else |
186 m_numTimesRecreateShouldFail--; | 186 m_numTimesRecreateShouldFail--; |
187 | 187 |
188 if (recreated) { | 188 if (recreated) { |
189 m_client->didRecreateOutputSurface(true); | 189 m_client->didRecreateOutputSurface(true); |
190 m_contextLost = false; | 190 m_contextLost = false; |
(...skipping 13 matching lines...) Expand all Loading... |
204 } | 204 } |
205 | 205 |
206 // 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 |
207 // back to software rendering. | 207 // back to software rendering. |
208 m_client->didRecreateOutputSurface(false); | 208 m_client->didRecreateOutputSurface(false); |
209 return RecreateFailedAndGaveUp; | 209 return RecreateFailedAndGaveUp; |
210 } | 210 } |
211 | 211 |
212 void CCLayerTreeHost::deleteContentsTexturesOnImplThread(CCResourceProvider* res
ourceProvider) | 212 void CCLayerTreeHost::deleteContentsTexturesOnImplThread(CCResourceProvider* res
ourceProvider) |
213 { | 213 { |
214 ASSERT(CCProxy::isImplThread()); | 214 DCHECK(CCProxy::isImplThread()); |
215 if (m_rendererInitialized) | 215 if (m_rendererInitialized) |
216 m_contentsTextureManager->clearAllMemory(resourceProvider); | 216 m_contentsTextureManager->clearAllMemory(resourceProvider); |
217 } | 217 } |
218 | 218 |
219 void CCLayerTreeHost::acquireLayerTextures() | 219 void CCLayerTreeHost::acquireLayerTextures() |
220 { | 220 { |
221 ASSERT(CCProxy::isMainThread()); | 221 DCHECK(CCProxy::isMainThread()); |
222 m_proxy->acquireLayerTextures(); | 222 m_proxy->acquireLayerTextures(); |
223 } | 223 } |
224 | 224 |
225 void CCLayerTreeHost::updateAnimations(double monotonicFrameBeginTime) | 225 void CCLayerTreeHost::updateAnimations(double monotonicFrameBeginTime) |
226 { | 226 { |
227 m_animating = true; | 227 m_animating = true; |
228 m_client->animate(monotonicFrameBeginTime); | 228 m_client->animate(monotonicFrameBeginTime); |
229 animateLayers(monotonicFrameBeginTime); | 229 animateLayers(monotonicFrameBeginTime); |
230 m_animating = false; | 230 m_animating = false; |
231 | 231 |
232 m_renderingStats.numAnimationFrames++; | 232 m_renderingStats.numAnimationFrames++; |
233 } | 233 } |
234 | 234 |
235 void CCLayerTreeHost::layout() | 235 void CCLayerTreeHost::layout() |
236 { | 236 { |
237 m_client->layout(); | 237 m_client->layout(); |
238 } | 238 } |
239 | 239 |
240 void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) | 240 void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) |
241 { | 241 { |
242 ASSERT(CCProxy::isImplThread()); | 242 DCHECK(CCProxy::isImplThread()); |
243 TRACE_EVENT0("cc", "CCLayerTreeHost::commitTo"); | 243 TRACE_EVENT0("cc", "CCLayerTreeHost::commitTo"); |
244 | 244 |
245 m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); | 245 m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); |
246 } | 246 } |
247 | 247 |
248 // This function commits the CCLayerTreeHost to an impl tree. When modifying | 248 // This function commits the CCLayerTreeHost to an impl tree. When modifying |
249 // this function, keep in mind that the function *runs* on the impl thread! Any | 249 // this function, keep in mind that the function *runs* on the impl thread! Any |
250 // code that is logically a main thread operation, e.g. deletion of a LayerChrom
ium, | 250 // code that is logically a main thread operation, e.g. deletion of a LayerChrom
ium, |
251 // should be delayed until the CCLayerTreeHost::commitComplete, which will run | 251 // should be delayed until the CCLayerTreeHost::commitComplete, which will run |
252 // after the commit, but on the main thread. | 252 // after the commit, but on the main thread. |
253 void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) | 253 void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) |
254 { | 254 { |
255 ASSERT(CCProxy::isImplThread()); | 255 DCHECK(CCProxy::isImplThread()); |
256 | 256 |
257 hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostI
mpl->detachLayerTree(), hostImpl)); | 257 hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostI
mpl->detachLayerTree(), hostImpl)); |
258 | 258 |
259 if (m_rootLayer && m_hudLayer) | 259 if (m_rootLayer && m_hudLayer) |
260 hostImpl->setHudLayer(static_cast<CCHeadsUpDisplayLayerImpl*>(CCLayerTre
eHostCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id()))); | 260 hostImpl->setHudLayer(static_cast<CCHeadsUpDisplayLayerImpl*>(CCLayerTre
eHostCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id()))); |
261 else | 261 else |
262 hostImpl->setHudLayer(0); | 262 hostImpl->setHudLayer(0); |
263 | 263 |
264 // We may have added an animation during the tree sync. This will cause both
layer tree hosts | 264 // We may have added an animation during the tree sync. This will cause both
layer tree hosts |
265 // to visit their controllers. | 265 // to visit their controllers. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 } | 314 } |
315 | 315 |
316 scoped_ptr<CCLayerTreeHostImpl> CCLayerTreeHost::createLayerTreeHostImpl(CCLayer
TreeHostImplClient* client) | 316 scoped_ptr<CCLayerTreeHostImpl> CCLayerTreeHost::createLayerTreeHostImpl(CCLayer
TreeHostImplClient* client) |
317 { | 317 { |
318 return CCLayerTreeHostImpl::create(m_settings, client); | 318 return CCLayerTreeHostImpl::create(m_settings, client); |
319 } | 319 } |
320 | 320 |
321 void CCLayerTreeHost::didLoseContext() | 321 void CCLayerTreeHost::didLoseContext() |
322 { | 322 { |
323 TRACE_EVENT0("cc", "CCLayerTreeHost::didLoseContext"); | 323 TRACE_EVENT0("cc", "CCLayerTreeHost::didLoseContext"); |
324 ASSERT(CCProxy::isMainThread()); | 324 DCHECK(CCProxy::isMainThread()); |
325 m_contextLost = true; | 325 m_contextLost = true; |
326 m_numFailedRecreateAttempts = 0; | 326 m_numFailedRecreateAttempts = 0; |
327 setNeedsCommit(); | 327 setNeedsCommit(); |
328 } | 328 } |
329 | 329 |
330 bool CCLayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) | 330 bool CCLayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) |
331 { | 331 { |
332 m_triggerIdleUpdates = false; | 332 m_triggerIdleUpdates = false; |
333 bool ret = m_proxy->compositeAndReadback(pixels, rect); | 333 bool ret = m_proxy->compositeAndReadback(pixels, rect); |
334 m_triggerIdleUpdates = true; | 334 m_triggerIdleUpdates = true; |
(...skipping 13 matching lines...) Expand all Loading... |
348 m_proxy->renderingStats(stats); | 348 m_proxy->renderingStats(stats); |
349 } | 349 } |
350 | 350 |
351 const RendererCapabilities& CCLayerTreeHost::rendererCapabilities() const | 351 const RendererCapabilities& CCLayerTreeHost::rendererCapabilities() const |
352 { | 352 { |
353 return m_proxy->rendererCapabilities(); | 353 return m_proxy->rendererCapabilities(); |
354 } | 354 } |
355 | 355 |
356 void CCLayerTreeHost::setNeedsAnimate() | 356 void CCLayerTreeHost::setNeedsAnimate() |
357 { | 357 { |
358 ASSERT(CCProxy::hasImplThread()); | 358 DCHECK(CCProxy::hasImplThread()); |
359 m_proxy->setNeedsAnimate(); | 359 m_proxy->setNeedsAnimate(); |
360 } | 360 } |
361 | 361 |
362 void CCLayerTreeHost::setNeedsCommit() | 362 void CCLayerTreeHost::setNeedsCommit() |
363 { | 363 { |
364 m_proxy->setNeedsCommit(); | 364 m_proxy->setNeedsCommit(); |
365 } | 365 } |
366 | 366 |
367 void CCLayerTreeHost::setNeedsRedraw() | 367 void CCLayerTreeHost::setNeedsRedraw() |
368 { | 368 { |
369 m_proxy->setNeedsRedraw(); | 369 m_proxy->setNeedsRedraw(); |
370 if (!CCThreadProxy::implThread()) | 370 if (!CCThreadProxy::implThread()) |
371 m_client->scheduleComposite(); | 371 m_client->scheduleComposite(); |
372 } | 372 } |
373 | 373 |
374 bool CCLayerTreeHost::commitRequested() const | 374 bool CCLayerTreeHost::commitRequested() const |
375 { | 375 { |
376 return m_proxy->commitRequested(); | 376 return m_proxy->commitRequested(); |
377 } | 377 } |
378 | 378 |
379 void CCLayerTreeHost::setAnimationEvents(scoped_ptr<CCAnimationEventsVector> eve
nts, double wallClockTime) | 379 void CCLayerTreeHost::setAnimationEvents(scoped_ptr<CCAnimationEventsVector> eve
nts, double wallClockTime) |
380 { | 380 { |
381 ASSERT(CCThreadProxy::isMainThread()); | 381 DCHECK(CCThreadProxy::isMainThread()); |
382 setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime)
; | 382 setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime)
; |
383 } | 383 } |
384 | 384 |
385 void CCLayerTreeHost::didAddAnimation() | 385 void CCLayerTreeHost::didAddAnimation() |
386 { | 386 { |
387 m_needsAnimateLayers = true; | 387 m_needsAnimateLayers = true; |
388 m_proxy->didAddAnimation(); | 388 m_proxy->didAddAnimation(); |
389 } | 389 } |
390 | 390 |
391 void CCLayerTreeHost::setRootLayer(scoped_refptr<LayerChromium> rootLayer) | 391 void CCLayerTreeHost::setRootLayer(scoped_refptr<LayerChromium> rootLayer) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 void CCLayerTreeHost::setVisible(bool visible) | 430 void CCLayerTreeHost::setVisible(bool visible) |
431 { | 431 { |
432 if (m_visible == visible) | 432 if (m_visible == visible) |
433 return; | 433 return; |
434 m_visible = visible; | 434 m_visible = visible; |
435 m_proxy->setVisible(visible); | 435 m_proxy->setVisible(visible); |
436 } | 436 } |
437 | 437 |
438 void CCLayerTreeHost::reduceContentsTexturesMemoryOnImplThread(size_t limitBytes
, CCResourceProvider* resourceProvider) | 438 void CCLayerTreeHost::reduceContentsTexturesMemoryOnImplThread(size_t limitBytes
, CCResourceProvider* resourceProvider) |
439 { | 439 { |
440 ASSERT(CCProxy::isImplThread()); | 440 DCHECK(CCProxy::isImplThread()); |
441 ASSERT(m_contentsTextureManager.get()); | 441 DCHECK(m_contentsTextureManager.get()); |
442 m_contentsTextureManager->reduceMemoryOnImplThread(limitBytes, resourceProvi
der); | 442 m_contentsTextureManager->reduceMemoryOnImplThread(limitBytes, resourceProvi
der); |
443 } | 443 } |
444 | 444 |
445 bool CCLayerTreeHost::evictedContentsTexturesBackingsExist() const | 445 bool CCLayerTreeHost::evictedContentsTexturesBackingsExist() const |
446 { | 446 { |
447 ASSERT(CCProxy::isImplThread()); | 447 DCHECK(CCProxy::isImplThread()); |
448 ASSERT(m_contentsTextureManager.get()); | 448 DCHECK(m_contentsTextureManager.get()); |
449 return m_contentsTextureManager->evictedBackingsExist(); | 449 return m_contentsTextureManager->evictedBackingsExist(); |
450 } | 450 } |
451 | 451 |
452 void CCLayerTreeHost::getEvictedContentTexturesBackings(CCPrioritizedTextureMana
ger::BackingVector& evictedBackings) | 452 void CCLayerTreeHost::getEvictedContentTexturesBackings(CCPrioritizedTextureMana
ger::BackingVector& evictedBackings) |
453 { | 453 { |
454 ASSERT(CCProxy::isImplThread()); | 454 DCHECK(CCProxy::isImplThread()); |
455 evictedBackings.clear(); | 455 evictedBackings.clear(); |
456 if (m_rendererInitialized) | 456 if (m_rendererInitialized) |
457 m_contentsTextureManager->getEvictedBackings(evictedBackings); | 457 m_contentsTextureManager->getEvictedBackings(evictedBackings); |
458 } | 458 } |
459 | 459 |
460 void CCLayerTreeHost::unlinkEvictedContentTexturesBackings(const CCPrioritizedTe
xtureManager::BackingVector& evictedBackings) | 460 void CCLayerTreeHost::unlinkEvictedContentTexturesBackings(const CCPrioritizedTe
xtureManager::BackingVector& evictedBackings) |
461 { | 461 { |
462 ASSERT(CCProxy::isMainThread()); | 462 DCHECK(CCProxy::isMainThread()); |
463 ASSERT(m_contentsTextureManager.get()); | 463 DCHECK(m_contentsTextureManager.get()); |
464 m_contentsTextureManager->unlinkEvictedBackings(evictedBackings); | 464 m_contentsTextureManager->unlinkEvictedBackings(evictedBackings); |
465 } | 465 } |
466 | 466 |
467 bool CCLayerTreeHost::deleteEvictedContentTexturesBackings() | 467 bool CCLayerTreeHost::deleteEvictedContentTexturesBackings() |
468 { | 468 { |
469 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); | 469 DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); |
470 ASSERT(m_contentsTextureManager.get()); | 470 DCHECK(m_contentsTextureManager.get()); |
471 return m_contentsTextureManager->deleteEvictedBackings(); | 471 return m_contentsTextureManager->deleteEvictedBackings(); |
472 } | 472 } |
473 | 473 |
474 void CCLayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, boo
l useAnchor, float scale, double durationSec) | 474 void CCLayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, boo
l useAnchor, float scale, double durationSec) |
475 { | 475 { |
476 m_proxy->startPageScaleAnimation(targetPosition, useAnchor, scale, durationS
ec); | 476 m_proxy->startPageScaleAnimation(targetPosition, useAnchor, scale, durationS
ec); |
477 } | 477 } |
478 | 478 |
479 void CCLayerTreeHost::loseContext(int numTimes) | 479 void CCLayerTreeHost::loseContext(int numTimes) |
480 { | 480 { |
481 TRACE_EVENT1("cc", "CCLayerTreeHost::loseCompositorContext", "numTimes", num
Times); | 481 TRACE_EVENT1("cc", "CCLayerTreeHost::loseCompositorContext", "numTimes", num
Times); |
482 m_numTimesRecreateShouldFail = numTimes - 1; | 482 m_numTimesRecreateShouldFail = numTimes - 1; |
483 m_proxy->loseContext(); | 483 m_proxy->loseContext(); |
484 } | 484 } |
485 | 485 |
486 CCPrioritizedTextureManager* CCLayerTreeHost::contentsTextureManager() const | 486 CCPrioritizedTextureManager* CCLayerTreeHost::contentsTextureManager() const |
487 { | 487 { |
488 return m_contentsTextureManager.get(); | 488 return m_contentsTextureManager.get(); |
489 } | 489 } |
490 | 490 |
491 void CCLayerTreeHost::composite() | 491 void CCLayerTreeHost::composite() |
492 { | 492 { |
493 ASSERT(!CCThreadProxy::implThread()); | 493 DCHECK(!CCThreadProxy::implThread()); |
494 static_cast<CCSingleThreadProxy*>(m_proxy.get())->compositeImmediately(); | 494 static_cast<CCSingleThreadProxy*>(m_proxy.get())->compositeImmediately(); |
495 } | 495 } |
496 | 496 |
497 void CCLayerTreeHost::scheduleComposite() | 497 void CCLayerTreeHost::scheduleComposite() |
498 { | 498 { |
499 m_client->scheduleComposite(); | 499 m_client->scheduleComposite(); |
500 } | 500 } |
501 | 501 |
502 bool CCLayerTreeHost::initializeRendererIfNeeded() | 502 bool CCLayerTreeHost::initializeRendererIfNeeded() |
503 { | 503 { |
504 if (!m_rendererInitialized) { | 504 if (!m_rendererInitialized) { |
505 initializeRenderer(); | 505 initializeRenderer(); |
506 // If we couldn't initialize, then bail since we're returning to softwar
e mode. | 506 // If we couldn't initialize, then bail since we're returning to softwar
e mode. |
507 if (!m_rendererInitialized) | 507 if (!m_rendererInitialized) |
508 return false; | 508 return false; |
509 } | 509 } |
510 if (m_contextLost) { | 510 if (m_contextLost) { |
511 if (recreateContext() != RecreateSucceeded) | 511 if (recreateContext() != RecreateSucceeded) |
512 return false; | 512 return false; |
513 } | 513 } |
514 return true; | 514 return true; |
515 } | 515 } |
516 | 516 |
517 void CCLayerTreeHost::updateLayers(CCTextureUpdateQueue& queue, size_t memoryAll
ocationLimitBytes) | 517 void CCLayerTreeHost::updateLayers(CCTextureUpdateQueue& queue, size_t memoryAll
ocationLimitBytes) |
518 { | 518 { |
519 ASSERT(m_rendererInitialized); | 519 DCHECK(m_rendererInitialized); |
520 ASSERT(memoryAllocationLimitBytes); | 520 DCHECK(memoryAllocationLimitBytes); |
521 | 521 |
522 if (!rootLayer()) | 522 if (!rootLayer()) |
523 return; | 523 return; |
524 | 524 |
525 if (layoutViewportSize().isEmpty()) | 525 if (layoutViewportSize().isEmpty()) |
526 return; | 526 return; |
527 | 527 |
528 m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBytes)
; | 528 m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBytes)
; |
529 | 529 |
530 updateLayers(rootLayer(), queue); | 530 updateLayers(rootLayer(), queue); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 CCOcclusionTracker occlusionTracker(m_rootLayer->renderSurface()->contentRec
t(), recordMetricsForFrame); | 701 CCOcclusionTracker occlusionTracker(m_rootLayer->renderSurface()->contentRec
t(), recordMetricsForFrame); |
702 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS
ize); | 702 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS
ize); |
703 | 703 |
704 prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics(
)); | 704 prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics(
)); |
705 | 705 |
706 CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList); | 706 CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList); |
707 for (CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayer
List); it != end; ++it) { | 707 for (CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayer
List); it != end; ++it) { |
708 occlusionTracker.enterLayer(it); | 708 occlusionTracker.enterLayer(it); |
709 | 709 |
710 if (it.representsTargetRenderSurface()) { | 710 if (it.representsTargetRenderSurface()) { |
711 ASSERT(it->renderSurface()->drawOpacity() || it->renderSurface()->dr
awOpacityIsAnimating()); | 711 DCHECK(it->renderSurface()->drawOpacity() || it->renderSurface()->dr
awOpacityIsAnimating()); |
712 needMoreUpdates |= paintMasksForRenderSurface(*it, queue); | 712 needMoreUpdates |= paintMasksForRenderSurface(*it, queue); |
713 } else if (it.representsItself()) { | 713 } else if (it.representsItself()) { |
714 ASSERT(!it->bounds().isEmpty()); | 714 DCHECK(!it->bounds().isEmpty()); |
715 it->update(queue, &occlusionTracker, m_renderingStats); | 715 it->update(queue, &occlusionTracker, m_renderingStats); |
716 needMoreUpdates |= it->needMoreUpdates(); | 716 needMoreUpdates |= it->needMoreUpdates(); |
717 } | 717 } |
718 | 718 |
719 occlusionTracker.leaveLayer(it); | 719 occlusionTracker.leaveLayer(it); |
720 } | 720 } |
721 | 721 |
722 occlusionTracker.overdrawMetrics().recordMetrics(this); | 722 occlusionTracker.overdrawMetrics().recordMetrics(this); |
723 | 723 |
724 return needMoreUpdates; | 724 return needMoreUpdates; |
(...skipping 23 matching lines...) Expand all Loading... |
748 void CCLayerTreeHost::setImplTransform(const WebKit::WebTransformationMatrix& tr
ansform) | 748 void CCLayerTreeHost::setImplTransform(const WebKit::WebTransformationMatrix& tr
ansform) |
749 { | 749 { |
750 m_implTransform = transform; | 750 m_implTransform = transform; |
751 } | 751 } |
752 | 752 |
753 void CCLayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) | 753 void CCLayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) |
754 { | 754 { |
755 if (m_animating) | 755 if (m_animating) |
756 return; | 756 return; |
757 | 757 |
758 ASSERT(context); | 758 DCHECK(context); |
759 RateLimiterMap::iterator it = m_rateLimiters.find(context); | 759 RateLimiterMap::iterator it = m_rateLimiters.find(context); |
760 if (it != m_rateLimiters.end()) | 760 if (it != m_rateLimiters.end()) |
761 it->second->start(); | 761 it->second->start(); |
762 else { | 762 else { |
763 scoped_refptr<RateLimiter> rateLimiter = RateLimiter::create(context, th
is); | 763 scoped_refptr<RateLimiter> rateLimiter = RateLimiter::create(context, th
is); |
764 m_rateLimiters[context] = rateLimiter; | 764 m_rateLimiters[context] = rateLimiter; |
765 rateLimiter->start(); | 765 rateLimiter->start(); |
766 } | 766 } |
767 } | 767 } |
768 | 768 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 else | 852 else |
853 layer->notifyAnimationFinished(wallClockTime); | 853 layer->notifyAnimationFinished(wallClockTime); |
854 } | 854 } |
855 } | 855 } |
856 | 856 |
857 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 857 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
858 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 858 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
859 } | 859 } |
860 | 860 |
861 } // namespace cc | 861 } // namespace cc |
OLD | NEW |