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 "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 Loading... | |
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 19 matching lines...) Expand all Loading... | |
573 m_commitRequested = false; | 563 m_commitRequested = false; |
574 m_commitRequestSentToImplThread = false; | 564 m_commitRequestSentToImplThread = false; |
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 |
573 if (m_layerTreeHost->contentsTextureManager()) | |
574 m_layerTreeHost->contentsTextureManager()->unlinkAndClearEvictedBackings (); | |
jamesr
2012/11/29 22:06:16
we don't need to know about unlinked state until u
ccameron
2012/11/29 22:25:35
Good point -- and I can get rid of the conditional
ccameron
2012/11/29 23:51:43
This turns out to be very complicated -- there are
| |
575 | |
583 if (beginFrameState) | 576 if (beginFrameState) |
584 m_layerTreeHost->updateAnimations(beginFrameState->monotonicFrameBeginTi me); | 577 m_layerTreeHost->updateAnimations(beginFrameState->monotonicFrameBeginTi me); |
585 m_layerTreeHost->layout(); | 578 m_layerTreeHost->layout(); |
586 | 579 |
587 // Clear the commit flag after updating animations and layout here --- objec ts that only | 580 // Clear the commit flag after updating animations and layout here --- objec ts that only |
588 // layout when painted will trigger another setNeedsCommit inside | 581 // layout when painted will trigger another setNeedsCommit inside |
589 // updateLayers. | 582 // updateLayers. |
590 m_commitRequested = false; | 583 m_commitRequested = false; |
591 m_commitRequestSentToImplThread = false; | 584 m_commitRequestSentToImplThread = false; |
592 | 585 |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
977 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() | 970 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() |
978 : memoryAllocationLimitBytes(0) | 971 : memoryAllocationLimitBytes(0) |
979 { | 972 { |
980 } | 973 } |
981 | 974 |
982 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() | 975 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() |
983 { | 976 { |
984 } | 977 } |
985 | 978 |
986 } // namespace cc | 979 } // namespace cc |
OLD | NEW |