| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost) | 72 CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost) |
| 73 : m_animateRequested(false) | 73 : m_animateRequested(false) |
| 74 , m_commitRequested(false) | 74 , m_commitRequested(false) |
| 75 , m_forcedCommitRequested(false) | 75 , m_forcedCommitRequested(false) |
| 76 , m_contextLost(false) | 76 , m_contextLost(false) |
| 77 , m_layerTreeHost(layerTreeHost) | 77 , m_layerTreeHost(layerTreeHost) |
| 78 , m_compositorIdentifier(-1) | 78 , m_compositorIdentifier(-1) |
| 79 , m_layerRendererInitialized(false) | 79 , m_layerRendererInitialized(false) |
| 80 , m_started(false) | 80 , m_started(false) |
| 81 , m_texturesAcquired(true) | 81 , m_texturesAcquired(true) |
| 82 , m_inCompositeAndReadback(false) |
| 82 , m_mainThreadProxy(CCScopedThreadProxy::create(CCProxy::mainThread())) | 83 , m_mainThreadProxy(CCScopedThreadProxy::create(CCProxy::mainThread())) |
| 83 , m_beginFrameCompletionEventOnImplThread(0) | 84 , m_beginFrameCompletionEventOnImplThread(0) |
| 84 , m_readbackRequestOnImplThread(0) | 85 , m_readbackRequestOnImplThread(0) |
| 85 , m_commitCompletionEventOnImplThread(0) | 86 , m_commitCompletionEventOnImplThread(0) |
| 86 , m_textureAcquisitionCompletionEventOnImplThread(0) | 87 , m_textureAcquisitionCompletionEventOnImplThread(0) |
| 87 , m_nextFrameIsNewlyCommittedFrameOnImplThread(false) | 88 , m_nextFrameIsNewlyCommittedFrameOnImplThread(false) |
| 88 { | 89 { |
| 89 TRACE_EVENT("CCThreadProxy::CCThreadProxy", this, 0); | 90 TRACE_EVENT("CCThreadProxy::CCThreadProxy", this, 0); |
| 90 ASSERT(isMainThread()); | 91 ASSERT(isMainThread()); |
| 91 } | 92 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 106 if (!m_layerTreeHost->initializeLayerRendererIfNeeded()) { | 107 if (!m_layerTreeHost->initializeLayerRendererIfNeeded()) { |
| 107 TRACE_EVENT("compositeAndReadback_EarlyOut_LR_Uninitialized", this, 0); | 108 TRACE_EVENT("compositeAndReadback_EarlyOut_LR_Uninitialized", this, 0); |
| 108 return false; | 109 return false; |
| 109 } | 110 } |
| 110 | 111 |
| 111 | 112 |
| 112 // Perform a synchronous commit. | 113 // Perform a synchronous commit. |
| 113 CCCompletionEvent beginFrameCompletion; | 114 CCCompletionEvent beginFrameCompletion; |
| 114 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::for
ceBeginFrameOnImplThread, AllowCrossThreadAccess(&beginFrameCompletion))); | 115 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::for
ceBeginFrameOnImplThread, AllowCrossThreadAccess(&beginFrameCompletion))); |
| 115 beginFrameCompletion.wait(); | 116 beginFrameCompletion.wait(); |
| 117 m_inCompositeAndReadback = true; |
| 116 beginFrame(); | 118 beginFrame(); |
| 119 m_inCompositeAndReadback = false; |
| 117 | 120 |
| 118 // Perform a synchronous readback. | 121 // Perform a synchronous readback. |
| 119 ReadbackRequest request; | 122 ReadbackRequest request; |
| 120 request.rect = rect; | 123 request.rect = rect; |
| 121 request.pixels = pixels; | 124 request.pixels = pixels; |
| 122 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::req
uestReadbackOnImplThread, AllowCrossThreadAccess(&request))); | 125 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::req
uestReadbackOnImplThread, AllowCrossThreadAccess(&request))); |
| 123 request.completion.wait(); | 126 request.completion.wait(); |
| 124 return request.success; | 127 return request.success; |
| 125 } | 128 } |
| 126 | 129 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 TRACE_EVENT0("cc", "CCThreadProxy::setSurfaceReady"); | 198 TRACE_EVENT0("cc", "CCThreadProxy::setSurfaceReady"); |
| 196 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::set
SurfaceReadyOnImplThread)); | 199 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::set
SurfaceReadyOnImplThread)); |
| 197 } | 200 } |
| 198 | 201 |
| 199 void CCThreadProxy::setSurfaceReadyOnImplThread() | 202 void CCThreadProxy::setSurfaceReadyOnImplThread() |
| 200 { | 203 { |
| 201 TRACE_EVENT0("cc", "CCThreadProxy::setSurfaceReadyOnImplThread"); | 204 TRACE_EVENT0("cc", "CCThreadProxy::setSurfaceReadyOnImplThread"); |
| 202 m_schedulerOnImplThread->setCanBeginFrame(true); | 205 m_schedulerOnImplThread->setCanBeginFrame(true); |
| 203 } | 206 } |
| 204 | 207 |
| 208 void CCThreadProxy::setVisible(bool visible) |
| 209 { |
| 210 TRACE_EVENT0("cc", "CCThreadProxy::setVisible"); |
| 211 CCCompletionEvent completion; |
| 212 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::set
VisibleOnImplThread, AllowCrossThreadAccess(&completion), visible)); |
| 213 completion.wait(); |
| 214 } |
| 215 |
| 216 void CCThreadProxy::setVisibleOnImplThread(CCCompletionEvent* completion, bool v
isible) |
| 217 { |
| 218 TRACE_EVENT0("cc", "CCThreadProxy::setVisibleOnImplThread"); |
| 219 m_layerTreeHostImpl->setVisible(visible); |
| 220 m_schedulerOnImplThread->setVisible(visible); |
| 221 completion->signal(); |
| 222 } |
| 223 |
| 205 bool CCThreadProxy::initializeLayerRenderer() | 224 bool CCThreadProxy::initializeLayerRenderer() |
| 206 { | 225 { |
| 207 TRACE_EVENT("CCThreadProxy::initializeLayerRenderer", this, 0); | 226 TRACE_EVENT("CCThreadProxy::initializeLayerRenderer", this, 0); |
| 208 // Make a blocking call to initializeLayerRendererOnImplThread. The results
of that call | 227 // Make a blocking call to initializeLayerRendererOnImplThread. The results
of that call |
| 209 // are pushed into the initializeSucceeded and capabilities local variables. | 228 // are pushed into the initializeSucceeded and capabilities local variables. |
| 210 CCCompletionEvent completion; | 229 CCCompletionEvent completion; |
| 211 bool initializeSucceeded = false; | 230 bool initializeSucceeded = false; |
| 212 LayerRendererCapabilities capabilities; | 231 LayerRendererCapabilities capabilities; |
| 213 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::ini
tializeLayerRendererOnImplThread, | 232 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::ini
tializeLayerRendererOnImplThread, |
| 214 AllowCrossThreadAccess(&c
ompletion), | 233 AllowCrossThreadAccess(&c
ompletion), |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 { | 311 { |
| 293 ASSERT(isMainThread()); | 312 ASSERT(isMainThread()); |
| 294 if (m_commitRequested) | 313 if (m_commitRequested) |
| 295 return; | 314 return; |
| 296 | 315 |
| 297 TRACE_EVENT("CCThreadProxy::setNeedsCommit", this, 0); | 316 TRACE_EVENT("CCThreadProxy::setNeedsCommit", this, 0); |
| 298 m_commitRequested = true; | 317 m_commitRequested = true; |
| 299 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::set
NeedsCommitOnImplThread)); | 318 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::set
NeedsCommitOnImplThread)); |
| 300 } | 319 } |
| 301 | 320 |
| 302 void CCThreadProxy::setNeedsForcedCommit() | |
| 303 { | |
| 304 ASSERT(isMainThread()); | |
| 305 if (m_forcedCommitRequested) | |
| 306 return; | |
| 307 | |
| 308 TRACE_EVENT("CCThreadProxy::setNeedsForcedCommit", this, 0); | |
| 309 m_commitRequested = true; | |
| 310 m_forcedCommitRequested = true; | |
| 311 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::set
NeedsForcedCommitOnImplThread)); | |
| 312 } | |
| 313 | |
| 314 void CCThreadProxy::didLoseContextOnImplThread() | 321 void CCThreadProxy::didLoseContextOnImplThread() |
| 315 { | 322 { |
| 316 ASSERT(isImplThread()); | 323 ASSERT(isImplThread()); |
| 317 TRACE_EVENT0("cc", "CCThreadProxy::didLoseContextOnImplThread"); | 324 TRACE_EVENT0("cc", "CCThreadProxy::didLoseContextOnImplThread"); |
| 318 m_schedulerOnImplThread->didLoseContext(); | 325 m_schedulerOnImplThread->didLoseContext(); |
| 319 } | 326 } |
| 320 | 327 |
| 321 void CCThreadProxy::onSwapBuffersCompleteOnImplThread() | 328 void CCThreadProxy::onSwapBuffersCompleteOnImplThread() |
| 322 { | 329 { |
| 323 ASSERT(isImplThread()); | 330 ASSERT(isImplThread()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 341 m_schedulerOnImplThread->setNeedsForcedCommit(); | 348 m_schedulerOnImplThread->setNeedsForcedCommit(); |
| 342 } | 349 } |
| 343 | 350 |
| 344 void CCThreadProxy::postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAni
mationEventsVector> events, double wallClockTime) | 351 void CCThreadProxy::postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAni
mationEventsVector> events, double wallClockTime) |
| 345 { | 352 { |
| 346 ASSERT(isImplThread()); | 353 ASSERT(isImplThread()); |
| 347 TRACE_EVENT("CCThreadProxy::postAnimationEventsToMainThreadOnImplThread", th
is, 0); | 354 TRACE_EVENT("CCThreadProxy::postAnimationEventsToMainThreadOnImplThread", th
is, 0); |
| 348 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::setAnim
ationEvents, events, wallClockTime)); | 355 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::setAnim
ationEvents, events, wallClockTime)); |
| 349 } | 356 } |
| 350 | 357 |
| 351 void CCThreadProxy::postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplT
hread(size_t bytes) | |
| 352 { | |
| 353 ASSERT(isImplThread()); | |
| 354 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::setCont
entsMemoryAllocationLimitBytes, bytes)); | |
| 355 } | |
| 356 | |
| 357 void CCThreadProxy::setNeedsRedraw() | 358 void CCThreadProxy::setNeedsRedraw() |
| 358 { | 359 { |
| 359 ASSERT(isMainThread()); | 360 ASSERT(isMainThread()); |
| 360 TRACE_EVENT("CCThreadProxy::setNeedsRedraw", this, 0); | 361 TRACE_EVENT("CCThreadProxy::setNeedsRedraw", this, 0); |
| 361 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::set
FullRootLayerDamageOnImplThread)); | 362 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::set
FullRootLayerDamageOnImplThread)); |
| 362 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::set
NeedsRedrawOnImplThread)); | 363 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::set
NeedsRedrawOnImplThread)); |
| 363 } | 364 } |
| 364 | 365 |
| 365 bool CCThreadProxy::commitRequested() const | 366 bool CCThreadProxy::commitRequested() const |
| 366 { | 367 { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 | 449 |
| 449 void CCThreadProxy::scheduledActionBeginFrame() | 450 void CCThreadProxy::scheduledActionBeginFrame() |
| 450 { | 451 { |
| 451 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionBeginFrame"); | 452 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionBeginFrame"); |
| 452 ASSERT(!m_pendingBeginFrameRequest); | 453 ASSERT(!m_pendingBeginFrameRequest); |
| 453 m_pendingBeginFrameRequest = adoptPtr(new BeginFrameAndCommitState()); | 454 m_pendingBeginFrameRequest = adoptPtr(new BeginFrameAndCommitState()); |
| 454 m_pendingBeginFrameRequest->monotonicFrameBeginTime = monotonicallyIncreasin
gTime(); | 455 m_pendingBeginFrameRequest->monotonicFrameBeginTime = monotonicallyIncreasin
gTime(); |
| 455 m_pendingBeginFrameRequest->scrollInfo = m_layerTreeHostImpl->processScrollD
eltas(); | 456 m_pendingBeginFrameRequest->scrollInfo = m_layerTreeHostImpl->processScrollD
eltas(); |
| 456 m_currentTextureUpdaterOnImplThread = adoptPtr(new CCTextureUpdater); | 457 m_currentTextureUpdaterOnImplThread = adoptPtr(new CCTextureUpdater); |
| 457 m_pendingBeginFrameRequest->updater = m_currentTextureUpdaterOnImplThread.ge
t(); | 458 m_pendingBeginFrameRequest->updater = m_currentTextureUpdaterOnImplThread.ge
t(); |
| 459 m_pendingBeginFrameRequest->contentsTexturesWereDeleted = m_layerTreeHostImp
l->contentsTexturesWerePurgedSinceLastCommit(); |
| 460 m_pendingBeginFrameRequest->memoryAllocationLimitBytes = m_layerTreeHostImpl
->memoryAllocationLimitBytes(); |
| 458 | 461 |
| 459 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFr
ame)); | 462 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFr
ame)); |
| 460 | 463 |
| 461 if (m_beginFrameCompletionEventOnImplThread) { | 464 if (m_beginFrameCompletionEventOnImplThread) { |
| 462 m_beginFrameCompletionEventOnImplThread->signal(); | 465 m_beginFrameCompletionEventOnImplThread->signal(); |
| 463 m_beginFrameCompletionEventOnImplThread = 0; | 466 m_beginFrameCompletionEventOnImplThread = 0; |
| 464 } | 467 } |
| 465 } | 468 } |
| 466 | 469 |
| 467 void CCThreadProxy::beginFrame() | 470 void CCThreadProxy::beginFrame() |
| (...skipping 22 matching lines...) Expand all Loading... |
| 490 | 493 |
| 491 // On the other hand, the animationRequested flag needs to be cleared | 494 // On the other hand, the animationRequested flag needs to be cleared |
| 492 // here so that any animation requests generated by the apply or animate | 495 // here so that any animation requests generated by the apply or animate |
| 493 // callbacks will trigger another frame. | 496 // callbacks will trigger another frame. |
| 494 m_animateRequested = false; | 497 m_animateRequested = false; |
| 495 | 498 |
| 496 // FIXME: technically, scroll deltas need to be applied for dropped commits
as well. | 499 // FIXME: technically, scroll deltas need to be applied for dropped commits
as well. |
| 497 // Re-do the commit flow so that we don't send the scrollInfo on the BFAC me
ssage. | 500 // Re-do the commit flow so that we don't send the scrollInfo on the BFAC me
ssage. |
| 498 m_layerTreeHost->applyScrollAndScale(*request->scrollInfo); | 501 m_layerTreeHost->applyScrollAndScale(*request->scrollInfo); |
| 499 | 502 |
| 503 if (!m_inCompositeAndReadback && !m_layerTreeHost->visible()) { |
| 504 m_commitRequested = false; |
| 505 m_forcedCommitRequested = false; |
| 506 |
| 507 TRACE_EVENT0("cc", "EarlyOut_NotVisible"); |
| 508 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy:
:beginFrameAbortedOnImplThread)); |
| 509 return; |
| 510 } |
| 511 |
| 500 m_layerTreeHost->willBeginFrame(); | 512 m_layerTreeHost->willBeginFrame(); |
| 501 | 513 |
| 502 // FIXME: recreate the context if it was requested by the impl thread. | |
| 503 m_layerTreeHost->updateAnimations(request->monotonicFrameBeginTime); | 514 m_layerTreeHost->updateAnimations(request->monotonicFrameBeginTime); |
| 504 m_layerTreeHost->layout(); | 515 m_layerTreeHost->layout(); |
| 505 | 516 |
| 506 // Clear the commit flag after updating animations and layout here --- objec
ts that only | 517 // Clear the commit flag after updating animations and layout here --- objec
ts that only |
| 507 // layout when painted will trigger another setNeedsCommit inside | 518 // layout when painted will trigger another setNeedsCommit inside |
| 508 // updateLayers. | 519 // updateLayers. |
| 509 m_commitRequested = false; | 520 m_commitRequested = false; |
| 510 m_forcedCommitRequested = false; | 521 m_forcedCommitRequested = false; |
| 511 | 522 |
| 512 if (!m_layerTreeHost->initializeLayerRendererIfNeeded()) | 523 if (!m_layerTreeHost->initializeLayerRendererIfNeeded()) |
| 513 return; | 524 return; |
| 514 | 525 |
| 515 m_layerTreeHost->updateLayers(*request->updater); | 526 if (request->contentsTexturesWereDeleted) |
| 527 m_layerTreeHost->evictAllContentTextures(); |
| 528 |
| 529 m_layerTreeHost->updateLayers(*request->updater, request->memoryAllocationLi
mitBytes); |
| 516 | 530 |
| 517 // Once single buffered layers are committed, they cannot be modified until | 531 // Once single buffered layers are committed, they cannot be modified until |
| 518 // they are drawn by the impl thread. | 532 // they are drawn by the impl thread. |
| 519 m_texturesAcquired = false; | 533 m_texturesAcquired = false; |
| 520 | 534 |
| 521 m_layerTreeHost->willCommit(); | 535 m_layerTreeHost->willCommit(); |
| 522 // Before applying scrolls and calling animate, we set m_animateRequested to
false. | 536 // Before applying scrolls and calling animate, we set m_animateRequested to
false. |
| 523 // If it is true now, it means setNeedAnimate was called again. Call setNeed
sCommit | 537 // If it is true now, it means setNeedAnimate was called again. Call setNeed
sCommit |
| 524 // now so that we get begin frame when this one is done. | 538 // now so that we get begin frame when this one is done. |
| 525 if (m_animateRequested) | 539 if (m_animateRequested) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 553 if (!m_layerTreeHostImpl) { | 567 if (!m_layerTreeHostImpl) { |
| 554 completion->signal(); | 568 completion->signal(); |
| 555 return; | 569 return; |
| 556 } | 570 } |
| 557 | 571 |
| 558 m_commitCompletionEventOnImplThread = completion; | 572 m_commitCompletionEventOnImplThread = completion; |
| 559 | 573 |
| 560 m_schedulerOnImplThread->beginFrameComplete(); | 574 m_schedulerOnImplThread->beginFrameComplete(); |
| 561 } | 575 } |
| 562 | 576 |
| 577 void CCThreadProxy::beginFrameAbortedOnImplThread() |
| 578 { |
| 579 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameAbortedOnImplThread"); |
| 580 ASSERT(isImplThread()); |
| 581 ASSERT(m_schedulerOnImplThread); |
| 582 ASSERT(m_schedulerOnImplThread->commitPending()); |
| 583 |
| 584 m_schedulerOnImplThread->beginFrameAborted(); |
| 585 } |
| 586 |
| 563 bool CCThreadProxy::hasMoreResourceUpdates() const | 587 bool CCThreadProxy::hasMoreResourceUpdates() const |
| 564 { | 588 { |
| 565 if (!m_currentTextureUpdaterOnImplThread) | 589 if (!m_currentTextureUpdaterOnImplThread) |
| 566 return false; | 590 return false; |
| 567 return m_currentTextureUpdaterOnImplThread->hasMoreUpdates(); | 591 return m_currentTextureUpdaterOnImplThread->hasMoreUpdates(); |
| 568 } | 592 } |
| 569 | 593 |
| 570 bool CCThreadProxy::canDraw() | 594 bool CCThreadProxy::canDraw() |
| 571 { | 595 { |
| 572 ASSERT(isImplThread()); | 596 ASSERT(isImplThread()); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 | 677 |
| 654 // Check for a pending compositeAndReadback. | 678 // Check for a pending compositeAndReadback. |
| 655 if (m_readbackRequestOnImplThread) { | 679 if (m_readbackRequestOnImplThread) { |
| 656 m_readbackRequestOnImplThread->success = false; | 680 m_readbackRequestOnImplThread->success = false; |
| 657 if (drawFrame) { | 681 if (drawFrame) { |
| 658 m_layerTreeHostImpl->readback(m_readbackRequestOnImplThread->pixels,
m_readbackRequestOnImplThread->rect); | 682 m_layerTreeHostImpl->readback(m_readbackRequestOnImplThread->pixels,
m_readbackRequestOnImplThread->rect); |
| 659 m_readbackRequestOnImplThread->success = !m_layerTreeHostImpl->isCon
textLost(); | 683 m_readbackRequestOnImplThread->success = !m_layerTreeHostImpl->isCon
textLost(); |
| 660 } | 684 } |
| 661 m_readbackRequestOnImplThread->completion.signal(); | 685 m_readbackRequestOnImplThread->completion.signal(); |
| 662 m_readbackRequestOnImplThread = 0; | 686 m_readbackRequestOnImplThread = 0; |
| 663 } | 687 } else if (drawFrame) |
| 664 | |
| 665 if (drawFrame) | |
| 666 result.didSwap = m_layerTreeHostImpl->swapBuffers(); | 688 result.didSwap = m_layerTreeHostImpl->swapBuffers(); |
| 667 | 689 |
| 668 // Tell the main thread that the the newly-commited frame was drawn. | 690 // Tell the main thread that the the newly-commited frame was drawn. |
| 669 if (m_nextFrameIsNewlyCommittedFrameOnImplThread) { | 691 if (m_nextFrameIsNewlyCommittedFrameOnImplThread) { |
| 670 m_nextFrameIsNewlyCommittedFrameOnImplThread = false; | 692 m_nextFrameIsNewlyCommittedFrameOnImplThread = false; |
| 671 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::did
CommitAndDrawFrame)); | 693 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::did
CommitAndDrawFrame)); |
| 672 } | 694 } |
| 673 | 695 |
| 674 return result; | 696 return result; |
| 675 } | 697 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 | 760 |
| 739 void CCThreadProxy::setAnimationEvents(PassOwnPtr<CCAnimationEventsVector> event
s, double wallClockTime) | 761 void CCThreadProxy::setAnimationEvents(PassOwnPtr<CCAnimationEventsVector> event
s, double wallClockTime) |
| 740 { | 762 { |
| 741 TRACE_EVENT0("cc", "CCThreadProxy::setAnimationEvents"); | 763 TRACE_EVENT0("cc", "CCThreadProxy::setAnimationEvents"); |
| 742 ASSERT(isMainThread()); | 764 ASSERT(isMainThread()); |
| 743 if (!m_layerTreeHost) | 765 if (!m_layerTreeHost) |
| 744 return; | 766 return; |
| 745 m_layerTreeHost->setAnimationEvents(events, wallClockTime); | 767 m_layerTreeHost->setAnimationEvents(events, wallClockTime); |
| 746 } | 768 } |
| 747 | 769 |
| 748 void CCThreadProxy::setContentsMemoryAllocationLimitBytes(size_t bytes) | |
| 749 { | |
| 750 ASSERT(isMainThread()); | |
| 751 if (!m_layerTreeHost) | |
| 752 return; | |
| 753 m_layerTreeHost->setContentsMemoryAllocationLimitBytes(bytes); | |
| 754 } | |
| 755 | |
| 756 class CCThreadProxyContextRecreationTimer : public CCTimer, CCTimerClient { | 770 class CCThreadProxyContextRecreationTimer : public CCTimer, CCTimerClient { |
| 757 public: | 771 public: |
| 758 static PassOwnPtr<CCThreadProxyContextRecreationTimer> create(CCThreadProxy*
proxy) { return adoptPtr(new CCThreadProxyContextRecreationTimer(proxy)); } | 772 static PassOwnPtr<CCThreadProxyContextRecreationTimer> create(CCThreadProxy*
proxy) { return adoptPtr(new CCThreadProxyContextRecreationTimer(proxy)); } |
| 759 | 773 |
| 760 virtual void onTimerFired() OVERRIDE | 774 virtual void onTimerFired() OVERRIDE |
| 761 { | 775 { |
| 762 m_proxy->tryToRecreateContext(); | 776 m_proxy->tryToRecreateContext(); |
| 763 } | 777 } |
| 764 | 778 |
| 765 private: | 779 private: |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 m_schedulerOnImplThread->setMaxFramesPending(2); | 842 m_schedulerOnImplThread->setMaxFramesPending(2); |
| 829 } | 843 } |
| 830 | 844 |
| 831 completion->signal(); | 845 completion->signal(); |
| 832 } | 846 } |
| 833 | 847 |
| 834 void CCThreadProxy::layerTreeHostClosedOnImplThread(CCCompletionEvent* completio
n) | 848 void CCThreadProxy::layerTreeHostClosedOnImplThread(CCCompletionEvent* completio
n) |
| 835 { | 849 { |
| 836 TRACE_EVENT("CCThreadProxy::layerTreeHostClosedOnImplThread", this, 0); | 850 TRACE_EVENT("CCThreadProxy::layerTreeHostClosedOnImplThread", this, 0); |
| 837 ASSERT(isImplThread()); | 851 ASSERT(isImplThread()); |
| 838 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->con
tentsTextureAllocator()); | 852 if (!m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit()) |
| 853 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl-
>contentsTextureAllocator()); |
| 839 m_inputHandlerOnImplThread.clear(); | 854 m_inputHandlerOnImplThread.clear(); |
| 840 m_layerTreeHostImpl.clear(); | 855 m_layerTreeHostImpl.clear(); |
| 841 m_schedulerOnImplThread.clear(); | 856 m_schedulerOnImplThread.clear(); |
| 842 completion->signal(); | 857 completion->signal(); |
| 843 } | 858 } |
| 844 | 859 |
| 845 void CCThreadProxy::setFullRootLayerDamageOnImplThread() | 860 void CCThreadProxy::setFullRootLayerDamageOnImplThread() |
| 846 { | 861 { |
| 847 ASSERT(isImplThread()); | 862 ASSERT(isImplThread()); |
| 848 m_layerTreeHostImpl->setFullRootLayerDamage(); | 863 m_layerTreeHostImpl->setFullRootLayerDamage(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 873 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->con
tentsTextureAllocator()); | 888 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->con
tentsTextureAllocator()); |
| 874 *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptRef(c
ontextPtr), textureUploader); | 889 *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptRef(c
ontextPtr), textureUploader); |
| 875 if (*recreateSucceeded) { | 890 if (*recreateSucceeded) { |
| 876 *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); | 891 *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); |
| 877 m_schedulerOnImplThread->didRecreateContext(); | 892 m_schedulerOnImplThread->didRecreateContext(); |
| 878 } | 893 } |
| 879 completion->signal(); | 894 completion->signal(); |
| 880 } | 895 } |
| 881 | 896 |
| 882 } // namespace WebCore | 897 } // namespace WebCore |
| OLD | NEW |