| 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 "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 PassOwnPtr<CCProxy> CCSingleThreadProxy::create(CCLayerTreeHost* layerTreeHost) | 21 PassOwnPtr<CCProxy> CCSingleThreadProxy::create(CCLayerTreeHost* layerTreeHost) |
| 22 { | 22 { |
| 23 return adoptPtr(new CCSingleThreadProxy(layerTreeHost)); | 23 return adoptPtr(new CCSingleThreadProxy(layerTreeHost)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost) | 26 CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost) |
| 27 : m_layerTreeHost(layerTreeHost) | 27 : m_layerTreeHost(layerTreeHost) |
| 28 , m_contextLost(false) | 28 , m_contextLost(false) |
| 29 , m_rendererInitialized(false) | 29 , m_rendererInitialized(false) |
| 30 , m_nextFrameIsNewlyCommittedFrame(false) | 30 , m_nextFrameIsNewlyCommittedFrame(false) |
| 31 , m_totalCommitCount(0) |
| 31 { | 32 { |
| 32 TRACE_EVENT0("cc", "CCSingleThreadProxy::CCSingleThreadProxy"); | 33 TRACE_EVENT0("cc", "CCSingleThreadProxy::CCSingleThreadProxy"); |
| 33 ASSERT(CCProxy::isMainThread()); | 34 ASSERT(CCProxy::isMainThread()); |
| 34 } | 35 } |
| 35 | 36 |
| 36 void CCSingleThreadProxy::start() | 37 void CCSingleThreadProxy::start() |
| 37 { | 38 { |
| 38 DebugScopedSetImplThread impl; | 39 DebugScopedSetImplThread impl; |
| 39 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); | 40 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); |
| 40 } | 41 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC
apabilities(); | 144 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC
apabilities(); |
| 144 } | 145 } |
| 145 } | 146 } |
| 146 | 147 |
| 147 if (initialized) | 148 if (initialized) |
| 148 m_contextLost = false; | 149 m_contextLost = false; |
| 149 | 150 |
| 150 return initialized; | 151 return initialized; |
| 151 } | 152 } |
| 152 | 153 |
| 153 void CCSingleThreadProxy::implSideRenderingStats(CCRenderingStats& stats) | 154 void CCSingleThreadProxy::renderingStats(CCRenderingStats* stats) |
| 154 { | 155 { |
| 156 stats->totalCommitTimeInSeconds = m_totalCommitTime.InSecondsF(); |
| 157 stats->totalCommitCount = m_totalCommitCount; |
| 155 m_layerTreeHostImpl->renderingStats(stats); | 158 m_layerTreeHostImpl->renderingStats(stats); |
| 156 } | 159 } |
| 157 | 160 |
| 158 const RendererCapabilities& CCSingleThreadProxy::rendererCapabilities() const | 161 const RendererCapabilities& CCSingleThreadProxy::rendererCapabilities() const |
| 159 { | 162 { |
| 160 ASSERT(m_rendererInitialized); | 163 ASSERT(m_rendererInitialized); |
| 161 // Note: this gets called during the commit by the "impl" thread | 164 // Note: this gets called during the commit by the "impl" thread |
| 162 return m_RendererCapabilitiesForMainThread; | 165 return m_RendererCapabilitiesForMainThread; |
| 163 } | 166 } |
| 164 | 167 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 176 } | 179 } |
| 177 | 180 |
| 178 void CCSingleThreadProxy::doCommit(PassOwnPtr<CCTextureUpdateQueue> queue) | 181 void CCSingleThreadProxy::doCommit(PassOwnPtr<CCTextureUpdateQueue> queue) |
| 179 { | 182 { |
| 180 ASSERT(CCProxy::isMainThread()); | 183 ASSERT(CCProxy::isMainThread()); |
| 181 // Commit immediately | 184 // Commit immediately |
| 182 { | 185 { |
| 183 DebugScopedSetMainThreadBlocked mainThreadBlocked; | 186 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 184 DebugScopedSetImplThread impl; | 187 DebugScopedSetImplThread impl; |
| 185 | 188 |
| 189 base::TimeTicks startTime = base::TimeTicks::HighResNow(); |
| 186 m_layerTreeHostImpl->beginCommit(); | 190 m_layerTreeHostImpl->beginCommit(); |
| 187 | 191 |
| 188 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); | 192 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); |
| 189 | 193 |
| 190 OwnPtr<CCTextureUpdateController> updateController = | 194 OwnPtr<CCTextureUpdateController> updateController = |
| 191 CCTextureUpdateController::create( | 195 CCTextureUpdateController::create( |
| 192 NULL, | 196 NULL, |
| 193 CCProxy::mainThread(), | 197 CCProxy::mainThread(), |
| 194 queue, | 198 queue, |
| 195 m_layerTreeHostImpl->resourceProvider(), | 199 m_layerTreeHostImpl->resourceProvider(), |
| 196 m_layerTreeHostImpl->resourceProvider()->textureUploader()); | 200 m_layerTreeHostImpl->resourceProvider()->textureUploader()); |
| 197 updateController->finalize(); | 201 updateController->finalize(); |
| 198 | 202 |
| 199 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); | 203 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); |
| 200 | 204 |
| 201 m_layerTreeHostImpl->commitComplete(); | 205 m_layerTreeHostImpl->commitComplete(); |
| 202 | 206 |
| 203 #if !ASSERT_DISABLED | 207 #if !ASSERT_DISABLED |
| 204 // In the single-threaded case, the scroll deltas should never be | 208 // In the single-threaded case, the scroll deltas should never be |
| 205 // touched on the impl layer tree. | 209 // touched on the impl layer tree. |
| 206 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->processScr
ollDeltas(); | 210 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->processScr
ollDeltas(); |
| 207 ASSERT(!scrollInfo->scrolls.size()); | 211 ASSERT(!scrollInfo->scrolls.size()); |
| 208 #endif | 212 #endif |
| 213 |
| 214 base::TimeTicks endTime = base::TimeTicks::HighResNow(); |
| 215 m_totalCommitTime += endTime - startTime; |
| 216 m_totalCommitCount++; |
| 209 } | 217 } |
| 210 m_layerTreeHost->commitComplete(); | 218 m_layerTreeHost->commitComplete(); |
| 211 m_nextFrameIsNewlyCommittedFrame = true; | 219 m_nextFrameIsNewlyCommittedFrame = true; |
| 212 } | 220 } |
| 213 | 221 |
| 214 void CCSingleThreadProxy::setNeedsCommit() | 222 void CCSingleThreadProxy::setNeedsCommit() |
| 215 { | 223 { |
| 216 ASSERT(CCProxy::isMainThread()); | 224 ASSERT(CCProxy::isMainThread()); |
| 217 m_layerTreeHost->scheduleComposite(); | 225 m_layerTreeHost->scheduleComposite(); |
| 218 } | 226 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 376 |
| 369 void CCSingleThreadProxy::didSwapFrame() | 377 void CCSingleThreadProxy::didSwapFrame() |
| 370 { | 378 { |
| 371 if (m_nextFrameIsNewlyCommittedFrame) { | 379 if (m_nextFrameIsNewlyCommittedFrame) { |
| 372 m_nextFrameIsNewlyCommittedFrame = false; | 380 m_nextFrameIsNewlyCommittedFrame = false; |
| 373 m_layerTreeHost->didCommitAndDrawFrame(); | 381 m_layerTreeHost->didCommitAndDrawFrame(); |
| 374 } | 382 } |
| 375 } | 383 } |
| 376 | 384 |
| 377 } | 385 } |
| OLD | NEW |