Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp

Issue 10836250: Merge 125577 - [chromium] race between CCLayerTreeHostImpl::releaseContentsTextures and CCThreadPro… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1229/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 , m_compositorIdentifier(-1) 73 , m_compositorIdentifier(-1)
74 , m_layerRendererInitialized(false) 74 , m_layerRendererInitialized(false)
75 , m_started(false) 75 , m_started(false)
76 , m_texturesAcquired(true) 76 , m_texturesAcquired(true)
77 , m_inCompositeAndReadback(false) 77 , m_inCompositeAndReadback(false)
78 , m_mainThreadProxy(CCScopedThreadProxy::create(CCProxy::mainThread())) 78 , m_mainThreadProxy(CCScopedThreadProxy::create(CCProxy::mainThread()))
79 , m_beginFrameCompletionEventOnImplThread(0) 79 , m_beginFrameCompletionEventOnImplThread(0)
80 , m_readbackRequestOnImplThread(0) 80 , m_readbackRequestOnImplThread(0)
81 , m_commitCompletionEventOnImplThread(0) 81 , m_commitCompletionEventOnImplThread(0)
82 , m_textureAcquisitionCompletionEventOnImplThread(0) 82 , m_textureAcquisitionCompletionEventOnImplThread(0)
83 , m_resetContentsTexturesPurgedAfterCommitOnImplThread(false)
83 , m_nextFrameIsNewlyCommittedFrameOnImplThread(false) 84 , m_nextFrameIsNewlyCommittedFrameOnImplThread(false)
84 , m_renderVSyncEnabled(layerTreeHost->settings().renderVSyncEnabled) 85 , m_renderVSyncEnabled(layerTreeHost->settings().renderVSyncEnabled)
85 { 86 {
86 TRACE_EVENT0("cc", "CCThreadProxy::CCThreadProxy"); 87 TRACE_EVENT0("cc", "CCThreadProxy::CCThreadProxy");
87 ASSERT(isMainThread()); 88 ASSERT(isMainThread());
88 } 89 }
89 90
90 CCThreadProxy::~CCThreadProxy() 91 CCThreadProxy::~CCThreadProxy()
91 { 92 {
92 TRACE_EVENT0("cc", "CCThreadProxy::~CCThreadProxy"); 93 TRACE_EVENT0("cc", "CCThreadProxy::~CCThreadProxy");
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 setNeedsForcedCommitOnImplThread(); 439 setNeedsForcedCommitOnImplThread();
439 } 440 }
440 441
441 void CCThreadProxy::scheduledActionBeginFrame() 442 void CCThreadProxy::scheduledActionBeginFrame()
442 { 443 {
443 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionBeginFrame"); 444 TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionBeginFrame");
444 ASSERT(!m_pendingBeginFrameRequest); 445 ASSERT(!m_pendingBeginFrameRequest);
445 m_pendingBeginFrameRequest = adoptPtr(new BeginFrameAndCommitState()); 446 m_pendingBeginFrameRequest = adoptPtr(new BeginFrameAndCommitState());
446 m_pendingBeginFrameRequest->monotonicFrameBeginTime = monotonicallyIncreasin gTime(); 447 m_pendingBeginFrameRequest->monotonicFrameBeginTime = monotonicallyIncreasin gTime();
447 m_pendingBeginFrameRequest->scrollInfo = m_layerTreeHostImpl->processScrollD eltas(); 448 m_pendingBeginFrameRequest->scrollInfo = m_layerTreeHostImpl->processScrollD eltas();
448 m_pendingBeginFrameRequest->contentsTexturesWereDeleted = m_layerTreeHostImp l->contentsTexturesWerePurgedSinceLastCommit(); 449 m_pendingBeginFrameRequest->contentsTexturesWereDeleted = m_layerTreeHostImp l->contentsTexturesPurged();
449 m_pendingBeginFrameRequest->memoryAllocationLimitBytes = m_layerTreeHostImpl ->memoryAllocationLimitBytes(); 450 m_pendingBeginFrameRequest->memoryAllocationLimitBytes = m_layerTreeHostImpl ->memoryAllocationLimitBytes();
450 451
451 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFr ame)); 452 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFr ame));
452 453
453 if (m_beginFrameCompletionEventOnImplThread) { 454 if (m_beginFrameCompletionEventOnImplThread) {
454 m_beginFrameCompletionEventOnImplThread->signal(); 455 m_beginFrameCompletionEventOnImplThread->signal();
455 m_beginFrameCompletionEventOnImplThread = 0; 456 m_beginFrameCompletionEventOnImplThread = 0;
456 } 457 }
457 } 458 }
458 459
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 532
532 // Notify the impl thread that the beginFrame has completed. This will 533 // Notify the impl thread that the beginFrame has completed. This will
533 // begin the commit process, which is blocking from the main thread's 534 // begin the commit process, which is blocking from the main thread's
534 // point of view, but asynchronously performed on the impl thread, 535 // point of view, but asynchronously performed on the impl thread,
535 // coordinated by the CCScheduler. 536 // coordinated by the CCScheduler.
536 { 537 {
537 TRACE_EVENT0("cc", "commit"); 538 TRACE_EVENT0("cc", "commit");
538 DebugScopedSetMainThreadBlocked mainThreadBlocked; 539 DebugScopedSetMainThreadBlocked mainThreadBlocked;
539 540
540 CCCompletionEvent completion; 541 CCCompletionEvent completion;
541 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy: :beginFrameCompleteOnImplThread, &completion, queue.release())); 542 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy: :beginFrameCompleteOnImplThread, &completion, queue.release(), request->contents TexturesWereDeleted));
542 completion.wait(); 543 completion.wait();
543 } 544 }
544 545
545 m_layerTreeHost->commitComplete(); 546 m_layerTreeHost->commitComplete();
546 m_layerTreeHost->didBeginFrame(); 547 m_layerTreeHost->didBeginFrame();
547 } 548 }
548 549
549 void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion , PassOwnPtr<CCTextureUpdateQueue> queue) 550 void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion , PassOwnPtr<CCTextureUpdateQueue> queue, bool contentsTexturesWereDeleted)
550 { 551 {
551 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread"); 552 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread");
552 ASSERT(!m_commitCompletionEventOnImplThread); 553 ASSERT(!m_commitCompletionEventOnImplThread);
553 ASSERT(isImplThread()); 554 ASSERT(isImplThread());
554 ASSERT(m_schedulerOnImplThread); 555 ASSERT(m_schedulerOnImplThread);
555 ASSERT(m_schedulerOnImplThread->commitPending()); 556 ASSERT(m_schedulerOnImplThread->commitPending());
556 557
557 if (!m_layerTreeHostImpl) { 558 if (!m_layerTreeHostImpl) {
558 completion->signal(); 559 completion->signal();
559 return; 560 return;
560 } 561 }
561 562
563 if (!contentsTexturesWereDeleted && m_layerTreeHostImpl->contentsTexturesPur ged()) {
564 // We purged the content textures on the impl thread between the time we
565 // posted the beginFrame task and now, meaning we have a bunch of
566 // uploads that are now invalid. Clear the uploads (they all go to
567 // content textures), and kick another commit to fill them again.
568 queue->clearUploads();
569 setNeedsCommitOnImplThread();
570 } else
571 m_resetContentsTexturesPurgedAfterCommitOnImplThread = true;
572
562 m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::cr eate(queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->layerR enderer()->textureCopier(), m_layerTreeHostImpl->layerRenderer()->textureUploade r()); 573 m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::cr eate(queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->layerR enderer()->textureCopier(), m_layerTreeHostImpl->layerRenderer()->textureUploade r());
563 m_commitCompletionEventOnImplThread = completion; 574 m_commitCompletionEventOnImplThread = completion;
564 575
565 m_schedulerOnImplThread->beginFrameComplete(); 576 m_schedulerOnImplThread->beginFrameComplete();
566 } 577 }
567 578
568 void CCThreadProxy::beginFrameAbortedOnImplThread() 579 void CCThreadProxy::beginFrameAbortedOnImplThread()
569 { 580 {
570 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameAbortedOnImplThread"); 581 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameAbortedOnImplThread");
571 ASSERT(isImplThread()); 582 ASSERT(isImplThread());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 ASSERT(!m_currentTextureUpdateControllerOnImplThread->hasMoreUpdates()); 616 ASSERT(!m_currentTextureUpdateControllerOnImplThread->hasMoreUpdates());
606 ASSERT(m_commitCompletionEventOnImplThread); 617 ASSERT(m_commitCompletionEventOnImplThread);
607 618
608 m_currentTextureUpdateControllerOnImplThread.clear(); 619 m_currentTextureUpdateControllerOnImplThread.clear();
609 620
610 m_layerTreeHostImpl->beginCommit(); 621 m_layerTreeHostImpl->beginCommit();
611 622
612 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); 623 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get());
613 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); 624 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get());
614 625
626 if (m_resetContentsTexturesPurgedAfterCommitOnImplThread) {
627 m_resetContentsTexturesPurgedAfterCommitOnImplThread = false;
628 m_layerTreeHostImpl->resetContentsTexturesPurged();
629 }
630
615 m_layerTreeHostImpl->commitComplete(); 631 m_layerTreeHostImpl->commitComplete();
616 632
617 m_nextFrameIsNewlyCommittedFrameOnImplThread = true; 633 m_nextFrameIsNewlyCommittedFrameOnImplThread = true;
618 634
619 m_commitCompletionEventOnImplThread->signal(); 635 m_commitCompletionEventOnImplThread->signal();
620 m_commitCompletionEventOnImplThread = 0; 636 m_commitCompletionEventOnImplThread = 0;
621 637
622 // SetVisible kicks off the next scheduler action, so this must be last. 638 // SetVisible kicks off the next scheduler action, so this must be last.
623 m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible()); 639 m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible());
624 } 640 }
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 m_schedulerOnImplThread->setMaxFramesPending(2); 855 m_schedulerOnImplThread->setMaxFramesPending(2);
840 } 856 }
841 857
842 completion->signal(); 858 completion->signal();
843 } 859 }
844 860
845 void CCThreadProxy::layerTreeHostClosedOnImplThread(CCCompletionEvent* completio n) 861 void CCThreadProxy::layerTreeHostClosedOnImplThread(CCCompletionEvent* completio n)
846 { 862 {
847 TRACE_EVENT0("cc", "CCThreadProxy::layerTreeHostClosedOnImplThread"); 863 TRACE_EVENT0("cc", "CCThreadProxy::layerTreeHostClosedOnImplThread");
848 ASSERT(isImplThread()); 864 ASSERT(isImplThread());
849 if (!m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit()) 865 if (!m_layerTreeHostImpl->contentsTexturesPurged())
850 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl- >resourceProvider()); 866 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl- >resourceProvider());
851 m_inputHandlerOnImplThread.clear(); 867 m_inputHandlerOnImplThread.clear();
852 m_layerTreeHostImpl.clear(); 868 m_layerTreeHostImpl.clear();
853 m_schedulerOnImplThread.clear(); 869 m_schedulerOnImplThread.clear();
854 completion->signal(); 870 completion->signal();
855 } 871 }
856 872
857 void CCThreadProxy::setFullRootLayerDamageOnImplThread() 873 void CCThreadProxy::setFullRootLayerDamageOnImplThread()
858 { 874 {
859 ASSERT(isImplThread()); 875 ASSERT(isImplThread());
(...skipping 19 matching lines...) Expand all
879 } 895 }
880 896
881 void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* comple tion, CCRenderingStats* stats) 897 void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* comple tion, CCRenderingStats* stats)
882 { 898 {
883 ASSERT(isImplThread()); 899 ASSERT(isImplThread());
884 m_layerTreeHostImpl->renderingStats(*stats); 900 m_layerTreeHostImpl->renderingStats(*stats);
885 completion->signal(); 901 completion->signal();
886 } 902 }
887 903
888 } // namespace WebCore 904 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h ('k') | Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698