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 "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 Loading... |
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 if (m_rendererInitialized) | 307 if (m_rendererInitialized) |
306 m_layerTreeHostImpl->renderer()->doNoOp(); | 308 m_layerTreeHostImpl->renderer()->doNoOp(); |
307 } | 309 } |
308 } | 310 } |
309 | 311 |
310 void CCSingleThreadProxy::onSwapBuffersCompleteOnImplThread() | 312 void CCSingleThreadProxy::onSwapBuffersCompleteOnImplThread() |
311 { | 313 { |
312 ASSERT_NOT_REACHED(); | 314 ASSERT_NOT_REACHED(); |
313 } | 315 } |
314 | 316 |
| 317 void CCSingleThreadProxy::onVSyncParametersChanged(double monotonicTimebase, dou
ble intervalInSeconds) |
| 318 { |
| 319 TRACE_EVENT2("cc", "CCSingleThreadProxy::onVSyncParametersChanged", "monoton
icTimebase", monotonicTimebase, "intervalInSeconds", intervalInSeconds); |
| 320 base::TimeTicks timebase = base::TimeTicks::FromInternalValue(monotonicTimeb
ase * base::Time::kMicrosecondsPerSecond); |
| 321 base::TimeDelta interval = base::TimeDelta::FromMicroseconds(intervalInSecon
ds * base::Time::kMicrosecondsPerSecond); |
| 322 m_layerTreeHostImpl->fpsCounter()->setTimebaseAndInterval(timebase, interval
); |
| 323 } |
| 324 |
315 bool CCSingleThreadProxy::commitAndComposite() | 325 bool CCSingleThreadProxy::commitAndComposite() |
316 { | 326 { |
317 ASSERT(CCProxy::isMainThread()); | 327 ASSERT(CCProxy::isMainThread()); |
318 | 328 |
319 if (!m_layerTreeHost->initializeRendererIfNeeded()) | 329 if (!m_layerTreeHost->initializeRendererIfNeeded()) |
320 return false; | 330 return false; |
321 | 331 |
322 // Unlink any texture backings that were deleted | 332 // Unlink any texture backings that were deleted |
323 CCPrioritizedTextureManager::BackingList evictedContentsTexturesBackings; | 333 CCPrioritizedTextureManager::BackingList evictedContentsTexturesBackings; |
324 { | 334 { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 386 |
377 void CCSingleThreadProxy::didSwapFrame() | 387 void CCSingleThreadProxy::didSwapFrame() |
378 { | 388 { |
379 if (m_nextFrameIsNewlyCommittedFrame) { | 389 if (m_nextFrameIsNewlyCommittedFrame) { |
380 m_nextFrameIsNewlyCommittedFrame = false; | 390 m_nextFrameIsNewlyCommittedFrame = false; |
381 m_layerTreeHost->didCommitAndDrawFrame(); | 391 m_layerTreeHost->didCommitAndDrawFrame(); |
382 } | 392 } |
383 } | 393 } |
384 | 394 |
385 } | 395 } |
OLD | NEW |