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

Side by Side Diff: cc/single_thread_proxy.cc

Issue 11028021: cc: Improve frame/commit accounting (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Make it work in single tread mode. Get rid of active concept. Created 8 years, 2 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
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 "CCSingleThreadProxy.h" 7 #include "CCSingleThreadProxy.h"
8 8
9 #include "CCDrawQuad.h" 9 #include "CCDrawQuad.h"
10 #include "CCFrameRateCounter.h"
10 #include "CCGraphicsContext.h" 11 #include "CCGraphicsContext.h"
11 #include "CCLayerTreeHost.h" 12 #include "CCLayerTreeHost.h"
12 #include "CCTextureUpdateController.h" 13 #include "CCTextureUpdateController.h"
13 #include "CCTimer.h" 14 #include "CCTimer.h"
14 #include "TraceEvent.h" 15 #include "TraceEvent.h"
15 #include <wtf/CurrentTime.h> 16 #include <wtf/CurrentTime.h>
16 17
17 using namespace WTF; 18 using namespace WTF;
18 19
19 namespace cc { 20 namespace cc {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 bool CCSingleThreadProxy::initializeRenderer() 111 bool CCSingleThreadProxy::initializeRenderer()
111 { 112 {
112 ASSERT(CCProxy::isMainThread()); 113 ASSERT(CCProxy::isMainThread());
113 ASSERT(m_contextBeforeInitialization.get()); 114 ASSERT(m_contextBeforeInitialization.get());
114 { 115 {
115 DebugScopedSetImplThread impl; 116 DebugScopedSetImplThread impl;
116 bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitial ization.Pass()); 117 bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitial ization.Pass());
117 if (ok) { 118 if (ok) {
118 m_rendererInitialized = true; 119 m_rendererInitialized = true;
119 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC apabilities(); 120 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC apabilities();
121 onVSyncParametersChanged(0, 1.0/60.0);
120 } 122 }
121 123
122 return ok; 124 return ok;
123 } 125 }
124 } 126 }
125 127
126 bool CCSingleThreadProxy::recreateContext() 128 bool CCSingleThreadProxy::recreateContext()
127 { 129 {
128 TRACE_EVENT0("cc", "CCSingleThreadProxy::recreateContext"); 130 TRACE_EVENT0("cc", "CCSingleThreadProxy::recreateContext");
129 ASSERT(CCProxy::isMainThread()); 131 ASSERT(CCProxy::isMainThread());
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 if (m_rendererInitialized) 305 if (m_rendererInitialized)
304 m_layerTreeHostImpl->renderer()->doNoOp(); 306 m_layerTreeHostImpl->renderer()->doNoOp();
305 } 307 }
306 } 308 }
307 309
308 void CCSingleThreadProxy::onSwapBuffersCompleteOnImplThread() 310 void CCSingleThreadProxy::onSwapBuffersCompleteOnImplThread()
309 { 311 {
310 ASSERT_NOT_REACHED(); 312 ASSERT_NOT_REACHED();
311 } 313 }
312 314
315 void CCSingleThreadProxy::onVSyncParametersChanged(double monotonicTimebase, dou ble intervalInSeconds)
316 {
317 TRACE_EVENT2("cc", "CCSingleThreadProxy::onVSyncParametersChanged", "monoton icTimebase", monotonicTimebase, "intervalInSeconds", intervalInSeconds);
318 base::TimeTicks timebase = base::TimeTicks::FromInternalValue(monotonicTimeb ase * base::Time::kMicrosecondsPerSecond);
319 base::TimeDelta interval = base::TimeDelta::FromMicroseconds(intervalInSecon ds * base::Time::kMicrosecondsPerSecond);
320 m_layerTreeHostImpl->fpsCounter()->setTimebaseAndInterval(timebase, interval );
321 }
322
313 bool CCSingleThreadProxy::commitAndComposite() 323 bool CCSingleThreadProxy::commitAndComposite()
314 { 324 {
315 ASSERT(CCProxy::isMainThread()); 325 ASSERT(CCProxy::isMainThread());
316 326
317 if (!m_layerTreeHost->initializeRendererIfNeeded()) 327 if (!m_layerTreeHost->initializeRendererIfNeeded())
318 return false; 328 return false;
319 329
320 // Unlink any texture backings that were deleted 330 // Unlink any texture backings that were deleted
321 CCPrioritizedTextureManager::BackingVector evictedContentsTexturesBackings; 331 CCPrioritizedTextureManager::BackingVector evictedContentsTexturesBackings;
322 { 332 {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 384
375 void CCSingleThreadProxy::didSwapFrame() 385 void CCSingleThreadProxy::didSwapFrame()
376 { 386 {
377 if (m_nextFrameIsNewlyCommittedFrame) { 387 if (m_nextFrameIsNewlyCommittedFrame) {
378 m_nextFrameIsNewlyCommittedFrame = false; 388 m_nextFrameIsNewlyCommittedFrame = false;
379 m_layerTreeHost->didCommitAndDrawFrame(); 389 m_layerTreeHost->didCommitAndDrawFrame();
380 } 390 }
381 } 391 }
382 392
383 } 393 }
OLDNEW
« cc/frame_rate_counter.cc ('K') | « cc/single_thread_proxy.h ('k') | cc/thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698