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

Side by Side Diff: cc/thread_proxy.cc

Issue 11411251: Use a lock to deal with concurrent access to the m_evictedBackings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make lock mutable Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « cc/thread_proxy.h ('k') | cc/tiled_layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/thread_proxy.h" 5 #include "cc/thread_proxy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "cc/delay_based_time_source.h" 9 #include "cc/delay_based_time_source.h"
10 #include "cc/draw_quad.h" 10 #include "cc/draw_quad.h"
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 509
510 void ThreadProxy::scheduledActionBeginFrame() 510 void ThreadProxy::scheduledActionBeginFrame()
511 { 511 {
512 TRACE_EVENT0("cc", "ThreadProxy::scheduledActionBeginFrame"); 512 TRACE_EVENT0("cc", "ThreadProxy::scheduledActionBeginFrame");
513 scoped_ptr<BeginFrameAndCommitState> beginFrameState(new BeginFrameAndCommit State); 513 scoped_ptr<BeginFrameAndCommitState> beginFrameState(new BeginFrameAndCommit State);
514 beginFrameState->monotonicFrameBeginTime = base::TimeTicks::Now(); 514 beginFrameState->monotonicFrameBeginTime = base::TimeTicks::Now();
515 beginFrameState->scrollInfo = m_layerTreeHostImpl->processScrollDeltas(); 515 beginFrameState->scrollInfo = m_layerTreeHostImpl->processScrollDeltas();
516 beginFrameState->implTransform = m_layerTreeHostImpl->implTransform(); 516 beginFrameState->implTransform = m_layerTreeHostImpl->implTransform();
517 DCHECK_GT(m_layerTreeHostImpl->memoryAllocationLimitBytes(), 0u); 517 DCHECK_GT(m_layerTreeHostImpl->memoryAllocationLimitBytes(), 0u);
518 beginFrameState->memoryAllocationLimitBytes = m_layerTreeHostImpl->memoryAll ocationLimitBytes(); 518 beginFrameState->memoryAllocationLimitBytes = m_layerTreeHostImpl->memoryAll ocationLimitBytes();
519 if (m_layerTreeHost->contentsTextureManager())
520 m_layerTreeHost->contentsTextureManager()->getEvictedBackings(beginFrame State->evictedContentsTexturesBackings);
521
522 m_mainThreadProxy->postTask(FROM_HERE, base::Bind(&ThreadProxy::beginFrame, base::Unretained(this), base::Passed(beginFrameState.Pass()))); 519 m_mainThreadProxy->postTask(FROM_HERE, base::Bind(&ThreadProxy::beginFrame, base::Unretained(this), base::Passed(beginFrameState.Pass())));
523 520
524 if (m_beginFrameCompletionEventOnImplThread) { 521 if (m_beginFrameCompletionEventOnImplThread) {
525 m_beginFrameCompletionEventOnImplThread->signal(); 522 m_beginFrameCompletionEventOnImplThread->signal();
526 m_beginFrameCompletionEventOnImplThread = 0; 523 m_beginFrameCompletionEventOnImplThread = 0;
527 } 524 }
528 } 525 }
529 526
530 void ThreadProxy::beginFrame(scoped_ptr<BeginFrameAndCommitState> beginFrameStat e) 527 void ThreadProxy::beginFrame(scoped_ptr<BeginFrameAndCommitState> beginFrameStat e)
531 { 528 {
532 TRACE_EVENT0("cc", "ThreadProxy::beginFrame"); 529 TRACE_EVENT0("cc", "ThreadProxy::beginFrame");
533 DCHECK(isMainThread()); 530 DCHECK(isMainThread());
534 if (!m_layerTreeHost) 531 if (!m_layerTreeHost)
535 return; 532 return;
536 533
537 // Be sure to never early-out of unlinking evicted textures whenever, so tha t
538 // the each evicted backing is sent to the main thread exactly once.
539 if (beginFrameState && !beginFrameState->evictedContentsTexturesBackings.emp ty()) {
540 DCHECK(m_layerTreeHost->contentsTextureManager());
541 m_layerTreeHost->contentsTextureManager()->unlinkEvictedBackings(beginFr ameState->evictedContentsTexturesBackings);
542 }
543
544 if (m_deferCommits) { 534 if (m_deferCommits) {
545 m_pendingDeferredCommit = beginFrameState.Pass(); 535 m_pendingDeferredCommit = beginFrameState.Pass();
546 m_layerTreeHost->didDeferCommit(); 536 m_layerTreeHost->didDeferCommit();
547 TRACE_EVENT0("cc", "EarlyOut_DeferCommits"); 537 TRACE_EVENT0("cc", "EarlyOut_DeferCommits");
548 return; 538 return;
549 } 539 }
550 540
551 if (m_layerTreeHost->needsSharedContext() && !WebSharedGraphicsContext3D::ha veCompositorThreadContext()) 541 if (m_layerTreeHost->needsSharedContext() && !WebSharedGraphicsContext3D::ha veCompositorThreadContext())
552 WebSharedGraphicsContext3D::createCompositorThreadContext(); 542 WebSharedGraphicsContext3D::createCompositorThreadContext();
553 543
(...skipping 21 matching lines...) Expand all
575 565
576 TRACE_EVENT0("cc", "EarlyOut_NotVisible"); 566 TRACE_EVENT0("cc", "EarlyOut_NotVisible");
577 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::beginFrameAborted OnImplThread, base::Unretained(this))); 567 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::beginFrameAborted OnImplThread, base::Unretained(this)));
578 return; 568 return;
579 } 569 }
580 570
581 m_layerTreeHost->willBeginFrame(); 571 m_layerTreeHost->willBeginFrame();
582 572
583 if (beginFrameState) 573 if (beginFrameState)
584 m_layerTreeHost->updateAnimations(beginFrameState->monotonicFrameBeginTi me); 574 m_layerTreeHost->updateAnimations(beginFrameState->monotonicFrameBeginTi me);
575
576 // Unlink any backings that the impl thread has evicted, so that we know to re-paint
577 // them in updateLayers.
578 if (m_layerTreeHost->contentsTextureManager())
579 m_layerTreeHost->contentsTextureManager()->unlinkAndClearEvictedBackings ();
580
585 m_layerTreeHost->layout(); 581 m_layerTreeHost->layout();
586 582
587 // Clear the commit flag after updating animations and layout here --- objec ts that only 583 // Clear the commit flag after updating animations and layout here --- objec ts that only
588 // layout when painted will trigger another setNeedsCommit inside 584 // layout when painted will trigger another setNeedsCommit inside
589 // updateLayers. 585 // updateLayers.
590 m_commitRequested = false; 586 m_commitRequested = false;
591 m_commitRequestSentToImplThread = false; 587 m_commitRequestSentToImplThread = false;
592 588
593 if (!m_layerTreeHost->initializeRendererIfNeeded()) { 589 if (!m_layerTreeHost->initializeRendererIfNeeded()) {
594 TRACE_EVENT0("cc", "EarlyOut_InitializeFailed"); 590 TRACE_EVENT0("cc", "EarlyOut_InitializeFailed");
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() 973 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState()
978 : memoryAllocationLimitBytes(0) 974 : memoryAllocationLimitBytes(0)
979 { 975 {
980 } 976 }
981 977
982 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() 978 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState()
983 { 979 {
984 } 980 }
985 981
986 } // namespace cc 982 } // namespace cc
OLDNEW
« no previous file with comments | « cc/thread_proxy.h ('k') | cc/tiled_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698