| 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 "cc/thread_proxy.h" | 7 #include "cc/thread_proxy.h" |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "cc/delay_based_time_source.h" | 10 #include "cc/delay_based_time_source.h" |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 | 499 |
| 500 void ThreadProxy::scheduledActionBeginFrame() | 500 void ThreadProxy::scheduledActionBeginFrame() |
| 501 { | 501 { |
| 502 TRACE_EVENT0("cc", "ThreadProxy::scheduledActionBeginFrame"); | 502 TRACE_EVENT0("cc", "ThreadProxy::scheduledActionBeginFrame"); |
| 503 DCHECK(!m_pendingBeginFrameRequest); | 503 DCHECK(!m_pendingBeginFrameRequest); |
| 504 m_pendingBeginFrameRequest = make_scoped_ptr(new BeginFrameAndCommitState())
; | 504 m_pendingBeginFrameRequest = make_scoped_ptr(new BeginFrameAndCommitState())
; |
| 505 m_pendingBeginFrameRequest->monotonicFrameBeginTime = base::TimeTicks::Now()
; | 505 m_pendingBeginFrameRequest->monotonicFrameBeginTime = base::TimeTicks::Now()
; |
| 506 m_pendingBeginFrameRequest->scrollInfo = m_layerTreeHostImpl->processScrollD
eltas(); | 506 m_pendingBeginFrameRequest->scrollInfo = m_layerTreeHostImpl->processScrollD
eltas(); |
| 507 m_pendingBeginFrameRequest->implTransform = m_layerTreeHostImpl->implTransfo
rm(); | 507 m_pendingBeginFrameRequest->implTransform = m_layerTreeHostImpl->implTransfo
rm(); |
| 508 m_pendingBeginFrameRequest->memoryAllocationLimitBytes = m_layerTreeHostImpl
->memoryAllocationLimitBytes(); | 508 m_pendingBeginFrameRequest->memoryAllocationLimitBytes = m_layerTreeHostImpl
->memoryAllocationLimitBytes(); |
| 509 if (m_layerTreeHost->contentsTextureManager()) | |
| 510 m_layerTreeHost->contentsTextureManager()->getEvictedBackings(m_pending
BeginFrameRequest->evictedContentsTexturesBackings); | |
| 511 | 509 |
| 512 m_mainThreadProxy->postTask(createThreadTask(this, &ThreadProxy::beginFrame)
); | 510 m_mainThreadProxy->postTask(createThreadTask(this, &ThreadProxy::beginFrame)
); |
| 513 | 511 |
| 514 if (m_beginFrameCompletionEventOnImplThread) { | 512 if (m_beginFrameCompletionEventOnImplThread) { |
| 515 m_beginFrameCompletionEventOnImplThread->signal(); | 513 m_beginFrameCompletionEventOnImplThread->signal(); |
| 516 m_beginFrameCompletionEventOnImplThread = 0; | 514 m_beginFrameCompletionEventOnImplThread = 0; |
| 517 } | 515 } |
| 518 } | 516 } |
| 519 | 517 |
| 520 void ThreadProxy::beginFrame() | 518 void ThreadProxy::beginFrame() |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 | 559 |
| 562 if (!m_inCompositeAndReadback && !m_layerTreeHost->visible()) { | 560 if (!m_inCompositeAndReadback && !m_layerTreeHost->visible()) { |
| 563 m_commitRequested = false; | 561 m_commitRequested = false; |
| 564 m_commitRequestSentToImplThread = false; | 562 m_commitRequestSentToImplThread = false; |
| 565 m_forcedCommitRequested = false; | 563 m_forcedCommitRequested = false; |
| 566 | 564 |
| 567 TRACE_EVENT0("cc", "EarlyOut_NotVisible"); | 565 TRACE_EVENT0("cc", "EarlyOut_NotVisible"); |
| 568 Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::begin
FrameAbortedOnImplThread)); | 566 Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::begin
FrameAbortedOnImplThread)); |
| 569 return; | 567 return; |
| 570 } | 568 } |
| 569 // Unlink any backings that the impl thread has evicted, so that we know to
re-paint |
| 570 // them in updateLayers. |
| 571 if (m_layerTreeHost->contentsTextureManager()) |
| 572 m_layerTreeHost->contentsTextureManager()->unlinkAndClearEvictedBackings
(); |
| 571 | 573 |
| 572 m_layerTreeHost->willBeginFrame(); | 574 m_layerTreeHost->willBeginFrame(); |
| 573 | 575 |
| 574 m_layerTreeHost->updateAnimations(request->monotonicFrameBeginTime); | 576 m_layerTreeHost->updateAnimations(request->monotonicFrameBeginTime); |
| 575 m_layerTreeHost->layout(); | 577 m_layerTreeHost->layout(); |
| 576 | 578 |
| 577 // Clear the commit flag after updating animations and layout here --- objec
ts that only | 579 // Clear the commit flag after updating animations and layout here --- objec
ts that only |
| 578 // layout when painted will trigger another setNeedsCommit inside | 580 // layout when painted will trigger another setNeedsCommit inside |
| 579 // updateLayers. | 581 // updateLayers. |
| 580 m_commitRequested = false; | 582 m_commitRequested = false; |
| 581 m_commitRequestSentToImplThread = false; | 583 m_commitRequestSentToImplThread = false; |
| 582 m_forcedCommitRequested = false; | 584 m_forcedCommitRequested = false; |
| 583 | 585 |
| 584 if (!m_layerTreeHost->initializeRendererIfNeeded()) { | 586 if (!m_layerTreeHost->initializeRendererIfNeeded()) { |
| 585 TRACE_EVENT0("cc", "EarlyOut_InitializeFailed"); | 587 TRACE_EVENT0("cc", "EarlyOut_InitializeFailed"); |
| 586 return; | 588 return; |
| 587 } | 589 } |
| 588 | 590 |
| 589 m_layerTreeHost->contentsTextureManager()->unlinkEvictedBackings(request->ev
ictedContentsTexturesBackings); | |
| 590 | |
| 591 scoped_ptr<ResourceUpdateQueue> queue = make_scoped_ptr(new ResourceUpdateQu
eue); | 591 scoped_ptr<ResourceUpdateQueue> queue = make_scoped_ptr(new ResourceUpdateQu
eue); |
| 592 m_layerTreeHost->updateLayers(*(queue.get()), request->memoryAllocationLimit
Bytes); | 592 m_layerTreeHost->updateLayers(*(queue.get()), request->memoryAllocationLimit
Bytes); |
| 593 | 593 |
| 594 // Once single buffered layers are committed, they cannot be modified until | 594 // Once single buffered layers are committed, they cannot be modified until |
| 595 // they are drawn by the impl thread. | 595 // they are drawn by the impl thread. |
| 596 m_texturesAcquired = false; | 596 m_texturesAcquired = false; |
| 597 | 597 |
| 598 m_layerTreeHost->willCommit(); | 598 m_layerTreeHost->willCommit(); |
| 599 // Before applying scrolls and calling animate, we set m_animateRequested to | 599 // Before applying scrolls and calling animate, we set m_animateRequested to |
| 600 // false. If it is true now, it means setNeedAnimate was called again, but | 600 // false. If it is true now, it means setNeedAnimate was called again, but |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 | 1003 |
| 1004 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() | 1004 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() |
| 1005 { | 1005 { |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() | 1008 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() |
| 1009 { | 1009 { |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 } // namespace cc | 1012 } // namespace cc |
| OLD | NEW |