Chromium Code Reviews| 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/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "cc/context_provider.h" | 10 #include "cc/context_provider.h" |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 819 DCHECK(IsImplThread()); | 819 DCHECK(IsImplThread()); |
| 820 DCHECK(m_layerTreeHostImpl.get()); | 820 DCHECK(m_layerTreeHostImpl.get()); |
| 821 if (!m_layerTreeHostImpl.get()) | 821 if (!m_layerTreeHostImpl.get()) |
| 822 return result; | 822 return result; |
| 823 | 823 |
| 824 DCHECK(m_layerTreeHostImpl->renderer()); | 824 DCHECK(m_layerTreeHostImpl->renderer()); |
| 825 if (!m_layerTreeHostImpl->renderer()) | 825 if (!m_layerTreeHostImpl->renderer()) |
| 826 return result; | 826 return result; |
| 827 | 827 |
| 828 // FIXME: compute the frame display time more intelligently | 828 // FIXME: compute the frame display time more intelligently |
| 829 base::TimeTicks monotonicTime = base::TimeTicks::Now(); | 829 base::TimeTicks monotonicTime = base::TimeTicks::Now(); |
|
egraether
2013/03/13 22:26:01
There's another time here that could be replaced b
| |
| 830 base::Time wallClockTime = base::Time::Now(); | 830 base::Time wallClockTime = base::Time::Now(); |
| 831 | 831 |
| 832 if (m_inputHandlerOnImplThread.get()) | 832 if (m_inputHandlerOnImplThread.get()) |
| 833 m_inputHandlerOnImplThread->animate(monotonicTime); | 833 m_inputHandlerOnImplThread->animate(monotonicTime); |
| 834 | 834 |
| 835 m_layerTreeHostImpl->activatePendingTreeIfNeeded(); | 835 m_layerTreeHostImpl->activatePendingTreeIfNeeded(); |
| 836 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime); | 836 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime); |
| 837 | 837 |
| 838 // This method is called on a forced draw, regardless of whether we are able to produce a frame, | 838 // This method is called on a forced draw, regardless of whether we are able to produce a frame, |
| 839 // as the calling site on main thread is blocked until its request completes , and we signal | 839 // as the calling site on main thread is blocked until its request completes , and we signal |
| 840 // completion here. If canDraw() is false, we will indicate success=false to the caller, but we | 840 // completion here. If canDraw() is false, we will indicate success=false to the caller, but we |
| 841 // must still signal completion to avoid deadlock. | 841 // must still signal completion to avoid deadlock. |
| 842 | 842 |
| 843 // We guard prepareToDraw() with canDraw() because it always returns a valid frame, so can only | 843 // We guard prepareToDraw() with canDraw() because it always returns a valid frame, so can only |
| 844 // be used when such a frame is possible. Since drawLayers() depends on the result of | 844 // be used when such a frame is possible. Since drawLayers() depends on the result of |
| 845 // prepareToDraw(), it is guarded on canDraw() as well. | 845 // prepareToDraw(), it is guarded on canDraw() as well. |
| 846 | 846 |
| 847 LayerTreeHostImpl::FrameData frame; | 847 LayerTreeHostImpl::FrameData frame; |
| 848 bool drawFrame = m_layerTreeHostImpl->canDraw() && (m_layerTreeHostImpl->pre pareToDraw(frame) || forcedDraw); | 848 bool drawFrame = m_layerTreeHostImpl->canDraw() && (m_layerTreeHostImpl->pre pareToDraw(frame) || forcedDraw); |
|
nduca
2013/03/13 05:53:28
i think we should pass the lastVsynctime to animat
egraether
2013/03/13 22:26:01
I think you are right, but I'm not sure what side
| |
| 849 if (drawFrame) { | 849 if (drawFrame) { |
| 850 m_layerTreeHostImpl->drawLayers(frame); | 850 m_layerTreeHostImpl->drawLayers(frame, m_schedulerOnImplThread->lastDraw Time()); |
| 851 result.didDraw = true; | 851 result.didDraw = true; |
| 852 } | 852 } |
| 853 m_layerTreeHostImpl->didDrawAllLayers(frame); | 853 m_layerTreeHostImpl->didDrawAllLayers(frame); |
| 854 | 854 |
| 855 // Check for tree activation. | 855 // Check for tree activation. |
| 856 if (m_completionEventForCommitHeldOnTreeActivation && !m_layerTreeHostImpl-> pendingTree()) | 856 if (m_completionEventForCommitHeldOnTreeActivation && !m_layerTreeHostImpl-> pendingTree()) |
| 857 { | 857 { |
| 858 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation"); | 858 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation"); |
| 859 DCHECK(m_layerTreeHostImpl->Settings().implSidePainting); | 859 DCHECK(m_layerTreeHostImpl->Settings().implSidePainting); |
| 860 m_completionEventForCommitHeldOnTreeActivation->signal(); | 860 m_completionEventForCommitHeldOnTreeActivation->signal(); |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1229 | 1229 |
| 1230 void ThreadProxy::renewTreePriorityOnImplThread() | 1230 void ThreadProxy::renewTreePriorityOnImplThread() |
| 1231 { | 1231 { |
| 1232 DCHECK(m_renewTreePriorityOnImplThreadPending); | 1232 DCHECK(m_renewTreePriorityOnImplThreadPending); |
| 1233 m_renewTreePriorityOnImplThreadPending = false; | 1233 m_renewTreePriorityOnImplThreadPending = false; |
| 1234 | 1234 |
| 1235 renewTreePriority(); | 1235 renewTreePriority(); |
| 1236 } | 1236 } |
| 1237 | 1237 |
| 1238 } // namespace cc | 1238 } // namespace cc |
| OLD | NEW |