| 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 "CCThreadProxy.h" | 7 #include "CCThreadProxy.h" |
| 8 | 8 |
| 9 #include "CCDelayBasedTimeSource.h" | 9 #include "CCDelayBasedTimeSource.h" |
| 10 #include "CCDrawQuad.h" | 10 #include "CCDrawQuad.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 , m_texturesAcquired(true) | 55 , m_texturesAcquired(true) |
| 56 , m_inCompositeAndReadback(false) | 56 , m_inCompositeAndReadback(false) |
| 57 , m_mainThreadProxy(CCScopedThreadProxy::create(CCProxy::mainThread())) | 57 , m_mainThreadProxy(CCScopedThreadProxy::create(CCProxy::mainThread())) |
| 58 , m_beginFrameCompletionEventOnImplThread(0) | 58 , m_beginFrameCompletionEventOnImplThread(0) |
| 59 , m_readbackRequestOnImplThread(0) | 59 , m_readbackRequestOnImplThread(0) |
| 60 , m_commitCompletionEventOnImplThread(0) | 60 , m_commitCompletionEventOnImplThread(0) |
| 61 , m_textureAcquisitionCompletionEventOnImplThread(0) | 61 , m_textureAcquisitionCompletionEventOnImplThread(0) |
| 62 , m_resetContentsTexturesPurgedAfterCommitOnImplThread(false) | 62 , m_resetContentsTexturesPurgedAfterCommitOnImplThread(false) |
| 63 , m_nextFrameIsNewlyCommittedFrameOnImplThread(false) | 63 , m_nextFrameIsNewlyCommittedFrameOnImplThread(false) |
| 64 , m_renderVSyncEnabled(layerTreeHost->settings().renderVSyncEnabled) | 64 , m_renderVSyncEnabled(layerTreeHost->settings().renderVSyncEnabled) |
| 65 , m_totalCommitTime(0) |
| 66 , m_totalCommitCount(0) |
| 65 { | 67 { |
| 66 TRACE_EVENT0("cc", "CCThreadProxy::CCThreadProxy"); | 68 TRACE_EVENT0("cc", "CCThreadProxy::CCThreadProxy"); |
| 67 ASSERT(isMainThread()); | 69 ASSERT(isMainThread()); |
| 68 } | 70 } |
| 69 | 71 |
| 70 CCThreadProxy::~CCThreadProxy() | 72 CCThreadProxy::~CCThreadProxy() |
| 71 { | 73 { |
| 72 TRACE_EVENT0("cc", "CCThreadProxy::~CCThreadProxy"); | 74 TRACE_EVENT0("cc", "CCThreadProxy::~CCThreadProxy"); |
| 73 ASSERT(isMainThread()); | 75 ASSERT(isMainThread()); |
| 74 ASSERT(!m_started); | 76 ASSERT(!m_started); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 context.leakPtr(), | 244 context.leakPtr(), |
| 243 &recreateSucceeded, | 245 &recreateSucceeded, |
| 244 &capabilities)); | 246 &capabilities)); |
| 245 completion.wait(); | 247 completion.wait(); |
| 246 | 248 |
| 247 if (recreateSucceeded) | 249 if (recreateSucceeded) |
| 248 m_RendererCapabilitiesMainThreadCopy = capabilities; | 250 m_RendererCapabilitiesMainThreadCopy = capabilities; |
| 249 return recreateSucceeded; | 251 return recreateSucceeded; |
| 250 } | 252 } |
| 251 | 253 |
| 252 void CCThreadProxy::implSideRenderingStats(CCRenderingStats& stats) | 254 void CCThreadProxy::renderingStats(CCRenderingStats& stats) |
| 253 { | 255 { |
| 254 ASSERT(isMainThread()); | 256 ASSERT(isMainThread()); |
| 255 | 257 |
| 256 DebugScopedSetMainThreadBlocked mainThreadBlocked; | 258 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 257 CCCompletionEvent completion; | 259 CCCompletionEvent completion; |
| 258 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::imp
lSideRenderingStatsOnImplThread, | 260 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::ren
deringStatsOnImplThread, |
| 259 &completion, | 261 &completion, |
| 260 &stats)); | 262 &stats)); |
| 263 stats.totalCommitTimeInSeconds = m_totalCommitTime; |
| 264 stats.totalCommitCount = m_totalCommitCount; |
| 265 |
| 261 completion.wait(); | 266 completion.wait(); |
| 262 } | 267 } |
| 263 | 268 |
| 264 const RendererCapabilities& CCThreadProxy::rendererCapabilities() const | 269 const RendererCapabilities& CCThreadProxy::rendererCapabilities() const |
| 265 { | 270 { |
| 266 ASSERT(m_rendererInitialized); | 271 ASSERT(m_rendererInitialized); |
| 267 return m_RendererCapabilitiesMainThreadCopy; | 272 return m_RendererCapabilitiesMainThreadCopy; |
| 268 } | 273 } |
| 269 | 274 |
| 270 void CCThreadProxy::loseContext() | 275 void CCThreadProxy::loseContext() |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 m_animateRequested = false; | 553 m_animateRequested = false; |
| 549 setNeedsAnimate(); | 554 setNeedsAnimate(); |
| 550 } | 555 } |
| 551 | 556 |
| 552 // Notify the impl thread that the beginFrame has completed. This will | 557 // Notify the impl thread that the beginFrame has completed. This will |
| 553 // begin the commit process, which is blocking from the main thread's | 558 // begin the commit process, which is blocking from the main thread's |
| 554 // point of view, but asynchronously performed on the impl thread, | 559 // point of view, but asynchronously performed on the impl thread, |
| 555 // coordinated by the CCScheduler. | 560 // coordinated by the CCScheduler. |
| 556 { | 561 { |
| 557 TRACE_EVENT0("cc", "commit"); | 562 TRACE_EVENT0("cc", "commit"); |
| 563 |
| 558 DebugScopedSetMainThreadBlocked mainThreadBlocked; | 564 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 559 | 565 |
| 566 double startTime = WTF::monotonicallyIncreasingTime(); |
| 560 CCCompletionEvent completion; | 567 CCCompletionEvent completion; |
| 561 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy:
:beginFrameCompleteOnImplThread, &completion, queue.release(), request->contents
TexturesWereDeleted)); | 568 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy:
:beginFrameCompleteOnImplThread, &completion, queue.release(), request->contents
TexturesWereDeleted)); |
| 562 completion.wait(); | 569 completion.wait(); |
| 570 double endTime = WTF::monotonicallyIncreasingTime(); |
| 571 |
| 572 double commitTime = endTime - startTime; |
| 573 m_totalCommitTime += commitTime; |
| 574 m_totalCommitCount++; |
| 563 } | 575 } |
| 564 | 576 |
| 565 m_layerTreeHost->commitComplete(); | 577 m_layerTreeHost->commitComplete(); |
| 566 m_layerTreeHost->didBeginFrame(); | 578 m_layerTreeHost->didBeginFrame(); |
| 567 } | 579 } |
| 568 | 580 |
| 569 void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion
, PassOwnPtr<CCTextureUpdateQueue> queue, bool contentsTexturesWereDeleted) | 581 void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion
, PassOwnPtr<CCTextureUpdateQueue> queue, bool contentsTexturesWereDeleted) |
| 570 { | 582 { |
| 571 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread"); | 583 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread"); |
| 572 ASSERT(!m_commitCompletionEventOnImplThread); | 584 ASSERT(!m_commitCompletionEventOnImplThread); |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 if (!m_layerTreeHostImpl->contentsTexturesPurged()) | 919 if (!m_layerTreeHostImpl->contentsTexturesPurged()) |
| 908 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl-
>resourceProvider()); | 920 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl-
>resourceProvider()); |
| 909 *recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(adoptPtr(contex
tPtr), textureUploader); | 921 *recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(adoptPtr(contex
tPtr), textureUploader); |
| 910 if (*recreateSucceeded) { | 922 if (*recreateSucceeded) { |
| 911 *capabilities = m_layerTreeHostImpl->rendererCapabilities(); | 923 *capabilities = m_layerTreeHostImpl->rendererCapabilities(); |
| 912 m_schedulerOnImplThread->didRecreateContext(); | 924 m_schedulerOnImplThread->didRecreateContext(); |
| 913 } | 925 } |
| 914 completion->signal(); | 926 completion->signal(); |
| 915 } | 927 } |
| 916 | 928 |
| 917 void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* comple
tion, CCRenderingStats* stats) | 929 void CCThreadProxy::renderingStatsOnImplThread(CCCompletionEvent* completion, CC
RenderingStats* stats) |
| 918 { | 930 { |
| 919 ASSERT(isImplThread()); | 931 ASSERT(isImplThread()); |
| 920 m_layerTreeHostImpl->renderingStats(*stats); | 932 m_layerTreeHostImpl->renderingStats(*stats); |
| 921 completion->signal(); | 933 completion->signal(); |
| 922 } | 934 } |
| 923 | 935 |
| 924 } // namespace WebCore | 936 } // namespace WebCore |
| OLD | NEW |