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

Side by Side Diff: cc/CCThreadProxy.cpp

Issue 10917153: Update cc snapshot to r127918 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months 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/CCThreadProxy.h ('k') | cc/CCThreadedTest.cpp » ('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 "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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 { 44 {
45 return adoptPtr(new CCThreadProxy(layerTreeHost)); 45 return adoptPtr(new CCThreadProxy(layerTreeHost));
46 } 46 }
47 47
48 CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost) 48 CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost)
49 : m_animateRequested(false) 49 : m_animateRequested(false)
50 , m_commitRequested(false) 50 , m_commitRequested(false)
51 , m_commitRequestSentToImplThread(false) 51 , m_commitRequestSentToImplThread(false)
52 , m_forcedCommitRequested(false) 52 , m_forcedCommitRequested(false)
53 , m_layerTreeHost(layerTreeHost) 53 , m_layerTreeHost(layerTreeHost)
54 , m_compositorIdentifier(-1)
55 , m_rendererInitialized(false) 54 , m_rendererInitialized(false)
56 , m_started(false) 55 , m_started(false)
57 , m_texturesAcquired(true) 56 , m_texturesAcquired(true)
58 , m_inCompositeAndReadback(false) 57 , m_inCompositeAndReadback(false)
59 , m_mainThreadProxy(CCScopedThreadProxy::create(CCProxy::mainThread())) 58 , m_mainThreadProxy(CCScopedThreadProxy::create(CCProxy::mainThread()))
60 , m_beginFrameCompletionEventOnImplThread(0) 59 , m_beginFrameCompletionEventOnImplThread(0)
61 , m_readbackRequestOnImplThread(0) 60 , m_readbackRequestOnImplThread(0)
62 , m_commitCompletionEventOnImplThread(0) 61 , m_commitCompletionEventOnImplThread(0)
63 , m_textureAcquisitionCompletionEventOnImplThread(0) 62 , m_textureAcquisitionCompletionEventOnImplThread(0)
64 , m_resetContentsTexturesPurgedAfterCommitOnImplThread(false) 63 , m_resetContentsTexturesPurgedAfterCommitOnImplThread(false)
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 context.leakPtr(), 243 context.leakPtr(),
245 &recreateSucceeded, 244 &recreateSucceeded,
246 &capabilities)); 245 &capabilities));
247 completion.wait(); 246 completion.wait();
248 247
249 if (recreateSucceeded) 248 if (recreateSucceeded)
250 m_RendererCapabilitiesMainThreadCopy = capabilities; 249 m_RendererCapabilitiesMainThreadCopy = capabilities;
251 return recreateSucceeded; 250 return recreateSucceeded;
252 } 251 }
253 252
254 int CCThreadProxy::compositorIdentifier() const
255 {
256 ASSERT(isMainThread());
257 return m_compositorIdentifier;
258 }
259
260 void CCThreadProxy::implSideRenderingStats(CCRenderingStats& stats) 253 void CCThreadProxy::implSideRenderingStats(CCRenderingStats& stats)
261 { 254 {
262 ASSERT(isMainThread()); 255 ASSERT(isMainThread());
263 256
264 DebugScopedSetMainThreadBlocked mainThreadBlocked; 257 DebugScopedSetMainThreadBlocked mainThreadBlocked;
265 CCCompletionEvent completion; 258 CCCompletionEvent completion;
266 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::imp lSideRenderingStatsOnImplThread, 259 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::imp lSideRenderingStatsOnImplThread,
267 &completion, 260 &completion,
268 &stats)); 261 &stats));
269 completion.wait(); 262 completion.wait();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 m_schedulerOnImplThread->setNeedsRedraw(); 375 m_schedulerOnImplThread->setNeedsRedraw();
383 } 376 }
384 377
385 void CCThreadProxy::start() 378 void CCThreadProxy::start()
386 { 379 {
387 ASSERT(isMainThread()); 380 ASSERT(isMainThread());
388 ASSERT(CCProxy::implThread()); 381 ASSERT(CCProxy::implThread());
389 // Create LayerTreeHostImpl. 382 // Create LayerTreeHostImpl.
390 DebugScopedSetMainThreadBlocked mainThreadBlocked; 383 DebugScopedSetMainThreadBlocked mainThreadBlocked;
391 CCCompletionEvent completion; 384 CCCompletionEvent completion;
392 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::ini tializeImplOnImplThread, &completion)); 385 OwnPtr<CCInputHandler> handler = m_layerTreeHost->createInputHandler();
386 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::ini tializeImplOnImplThread, &completion, handler.release()));
393 completion.wait(); 387 completion.wait();
394 388
395 m_started = true; 389 m_started = true;
396 } 390 }
397 391
398 void CCThreadProxy::stop() 392 void CCThreadProxy::stop()
399 { 393 {
400 TRACE_EVENT0("cc", "CCThreadProxy::stop"); 394 TRACE_EVENT0("cc", "CCThreadProxy::stop");
401 ASSERT(isMainThread()); 395 ASSERT(isMainThread());
402 ASSERT(m_started); 396 ASSERT(m_started);
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 return result; 669 return result;
676 670
677 ASSERT(m_layerTreeHostImpl->renderer()); 671 ASSERT(m_layerTreeHostImpl->renderer());
678 if (!m_layerTreeHostImpl->renderer()) 672 if (!m_layerTreeHostImpl->renderer())
679 return result; 673 return result;
680 674
681 // FIXME: compute the frame display time more intelligently 675 // FIXME: compute the frame display time more intelligently
682 double monotonicTime = monotonicallyIncreasingTime(); 676 double monotonicTime = monotonicallyIncreasingTime();
683 double wallClockTime = currentTime(); 677 double wallClockTime = currentTime();
684 678
685 m_inputHandlerOnImplThread->animate(monotonicTime); 679 if (m_inputHandlerOnImplThread)
680 m_inputHandlerOnImplThread->animate(monotonicTime);
686 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime); 681 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime);
687 682
688 // This method is called on a forced draw, regardless of whether we are able to produce a frame, 683 // This method is called on a forced draw, regardless of whether we are able to produce a frame,
689 // as the calling site on main thread is blocked until its request completes , and we signal 684 // as the calling site on main thread is blocked until its request completes , and we signal
690 // completion here. If canDraw() is false, we will indicate success=false to the caller, but we 685 // completion here. If canDraw() is false, we will indicate success=false to the caller, but we
691 // must still signal completion to avoid deadlock. 686 // must still signal completion to avoid deadlock.
692 687
693 // We guard prepareToDraw() with canDraw() because it always returns a valid frame, so can only 688 // We guard prepareToDraw() with canDraw() because it always returns a valid frame, so can only
694 // be used when such a frame is possible. Since drawLayers() depends on the result of 689 // be used when such a frame is possible. Since drawLayers() depends on the result of
695 // prepareToDraw(), it is guarded on canDraw() as well. 690 // prepareToDraw(), it is guarded on canDraw() as well.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 { 823 {
829 ASSERT(isMainThread()); 824 ASSERT(isMainThread());
830 ASSERT(m_layerTreeHost); 825 ASSERT(m_layerTreeHost);
831 CCLayerTreeHost::RecreateResult result = m_layerTreeHost->recreateContext(); 826 CCLayerTreeHost::RecreateResult result = m_layerTreeHost->recreateContext();
832 if (result == CCLayerTreeHost::RecreateFailedButTryAgain) 827 if (result == CCLayerTreeHost::RecreateFailedButTryAgain)
833 m_contextRecreationTimer->startOneShot(contextRecreationTickRate); 828 m_contextRecreationTimer->startOneShot(contextRecreationTickRate);
834 else if (result == CCLayerTreeHost::RecreateSucceeded) 829 else if (result == CCLayerTreeHost::RecreateSucceeded)
835 m_contextRecreationTimer.clear(); 830 m_contextRecreationTimer.clear();
836 } 831 }
837 832
838 void CCThreadProxy::initializeImplOnImplThread(CCCompletionEvent* completion) 833 void CCThreadProxy::initializeImplOnImplThread(CCCompletionEvent* completion, Pa ssOwnPtr<CCInputHandler> popHandler)
839 { 834 {
840 TRACE_EVENT0("cc", "CCThreadProxy::initializeImplOnImplThread"); 835 TRACE_EVENT0("cc", "CCThreadProxy::initializeImplOnImplThread");
841 ASSERT(isImplThread()); 836 ASSERT(isImplThread());
842 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); 837 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this);
843 const double displayRefreshInterval = 1.0 / 60.0; 838 const double displayRefreshInterval = 1.0 / 60.0;
844 OwnPtr<CCFrameRateController> frameRateController; 839 OwnPtr<CCFrameRateController> frameRateController;
845 if (m_renderVSyncEnabled) 840 if (m_renderVSyncEnabled)
846 frameRateController = adoptPtr(new CCFrameRateController(CCDelayBasedTim eSource::create(displayRefreshInterval, CCProxy::implThread()))); 841 frameRateController = adoptPtr(new CCFrameRateController(CCDelayBasedTim eSource::create(displayRefreshInterval, CCProxy::implThread())));
847 else 842 else
848 frameRateController = adoptPtr(new CCFrameRateController(CCProxy::implTh read())); 843 frameRateController = adoptPtr(new CCFrameRateController(CCProxy::implTh read()));
849 m_schedulerOnImplThread = CCScheduler::create(this, frameRateController.rele ase()); 844 m_schedulerOnImplThread = CCScheduler::create(this, frameRateController.rele ase());
850 m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible()); 845 m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible());
851 846
852 m_inputHandlerOnImplThread = CCInputHandler::create(m_layerTreeHostImpl.get( )); 847 m_inputHandlerOnImplThread = popHandler;
853 m_compositorIdentifier = m_inputHandlerOnImplThread->identifier(); 848 if (m_inputHandlerOnImplThread)
849 m_inputHandlerOnImplThread->bindToClient(m_layerTreeHostImpl.get());
854 850
855 completion->signal(); 851 completion->signal();
856 } 852 }
857 853
858 void CCThreadProxy::initializeContextOnImplThread(CCGraphicsContext* context) 854 void CCThreadProxy::initializeContextOnImplThread(CCGraphicsContext* context)
859 { 855 {
860 TRACE_EVENT0("cc", "CCThreadProxy::initializeContextOnImplThread"); 856 TRACE_EVENT0("cc", "CCThreadProxy::initializeContextOnImplThread");
861 ASSERT(isImplThread()); 857 ASSERT(isImplThread());
862 m_contextBeforeInitializationOnImplThread = adoptPtr(context); 858 m_contextBeforeInitializationOnImplThread = adoptPtr(context);
863 } 859 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 } 911 }
916 912
917 void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* comple tion, CCRenderingStats* stats) 913 void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* comple tion, CCRenderingStats* stats)
918 { 914 {
919 ASSERT(isImplThread()); 915 ASSERT(isImplThread());
920 m_layerTreeHostImpl->renderingStats(*stats); 916 m_layerTreeHostImpl->renderingStats(*stats);
921 completion->signal(); 917 completion->signal();
922 } 918 }
923 919
924 } // namespace WebCore 920 } // namespace WebCore
OLDNEW
« no previous file with comments | « cc/CCThreadProxy.h ('k') | cc/CCThreadedTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698