Chromium Code Reviews| 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_totalCommitTime(0) | |
|
nduca
2012/09/15 00:36:09
here and elsewhere, add unit. m_totalCommitTimeInS
brianderson
2012/09/18 01:16:44
Done.
| |
| 32 , m_totalCommitCount(0) | |
| 31 { | 33 { |
| 32 TRACE_EVENT0("cc", "CCSingleThreadProxy::CCSingleThreadProxy"); | 34 TRACE_EVENT0("cc", "CCSingleThreadProxy::CCSingleThreadProxy"); |
| 33 ASSERT(CCProxy::isMainThread()); | 35 ASSERT(CCProxy::isMainThread()); |
| 34 } | 36 } |
| 35 | 37 |
| 36 void CCSingleThreadProxy::start() | 38 void CCSingleThreadProxy::start() |
| 37 { | 39 { |
| 38 DebugScopedSetImplThread impl; | 40 DebugScopedSetImplThread impl; |
| 39 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); | 41 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); |
| 40 } | 42 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC apabilities(); | 145 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC apabilities(); |
| 144 } | 146 } |
| 145 } | 147 } |
| 146 | 148 |
| 147 if (initialized) | 149 if (initialized) |
| 148 m_contextLost = false; | 150 m_contextLost = false; |
| 149 | 151 |
| 150 return initialized; | 152 return initialized; |
| 151 } | 153 } |
| 152 | 154 |
| 153 void CCSingleThreadProxy::implSideRenderingStats(CCRenderingStats& stats) | 155 void CCSingleThreadProxy::renderingStats(CCRenderingStats& stats) |
| 154 { | 156 { |
| 157 stats.totalCommitTimeInSeconds = m_totalCommitTime; | |
| 158 stats.totalCommitCount = m_totalCommitCount; | |
| 155 m_layerTreeHostImpl->renderingStats(stats); | 159 m_layerTreeHostImpl->renderingStats(stats); |
| 156 } | 160 } |
| 157 | 161 |
| 158 const RendererCapabilities& CCSingleThreadProxy::rendererCapabilities() const | 162 const RendererCapabilities& CCSingleThreadProxy::rendererCapabilities() const |
| 159 { | 163 { |
| 160 ASSERT(m_rendererInitialized); | 164 ASSERT(m_rendererInitialized); |
| 161 // Note: this gets called during the commit by the "impl" thread | 165 // Note: this gets called during the commit by the "impl" thread |
| 162 return m_RendererCapabilitiesForMainThread; | 166 return m_RendererCapabilitiesForMainThread; |
| 163 } | 167 } |
| 164 | 168 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 176 } | 180 } |
| 177 | 181 |
| 178 void CCSingleThreadProxy::doCommit(CCTextureUpdateQueue& queue) | 182 void CCSingleThreadProxy::doCommit(CCTextureUpdateQueue& queue) |
| 179 { | 183 { |
| 180 ASSERT(CCProxy::isMainThread()); | 184 ASSERT(CCProxy::isMainThread()); |
| 181 // Commit immediately | 185 // Commit immediately |
| 182 { | 186 { |
| 183 DebugScopedSetMainThreadBlocked mainThreadBlocked; | 187 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 184 DebugScopedSetImplThread impl; | 188 DebugScopedSetImplThread impl; |
| 185 | 189 |
| 190 double startTime = WTF::monotonicallyIncreasingTime(); | |
| 186 m_layerTreeHostImpl->beginCommit(); | 191 m_layerTreeHostImpl->beginCommit(); |
| 187 | 192 |
| 188 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); | 193 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); |
| 189 | 194 |
| 190 // CCTextureUpdateController::updateTextures is non-blocking and will | 195 // CCTextureUpdateController::updateTextures is non-blocking and will |
| 191 // return without updating any textures if the uploader is busy. This | 196 // return without updating any textures if the uploader is busy. This |
| 192 // shouldn't be a problem here as the throttled uploader isn't used in | 197 // shouldn't be a problem here as the throttled uploader isn't used in |
| 193 // single thread mode. For correctness, loop until no more updates are | 198 // single thread mode. For correctness, loop until no more updates are |
| 194 // pending. | 199 // pending. |
| 195 while (queue.hasMoreUpdates()) | 200 while (queue.hasMoreUpdates()) |
| 196 CCTextureUpdateController::updateTextures(m_layerTreeHostImpl->resou rceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHost Impl->renderer()->textureUploader(), &queue, maxPartialTextureUpdates()); | 201 CCTextureUpdateController::updateTextures(m_layerTreeHostImpl->resou rceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHost Impl->renderer()->textureUploader(), &queue, maxPartialTextureUpdates()); |
| 197 | 202 |
| 198 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); | 203 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); |
| 199 | 204 |
| 200 m_layerTreeHostImpl->commitComplete(); | 205 m_layerTreeHostImpl->commitComplete(); |
| 201 | 206 |
| 202 #if !ASSERT_DISABLED | 207 #if !ASSERT_DISABLED |
| 203 // In the single-threaded case, the scroll deltas should never be | 208 // In the single-threaded case, the scroll deltas should never be |
| 204 // touched on the impl layer tree. | 209 // touched on the impl layer tree. |
| 205 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->processScr ollDeltas(); | 210 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->processScr ollDeltas(); |
| 206 ASSERT(!scrollInfo->scrolls.size()); | 211 ASSERT(!scrollInfo->scrolls.size()); |
| 207 #endif | 212 #endif |
| 213 | |
| 214 double endTime = WTF::monotonicallyIncreasingTime(); | |
| 215 double commitTime = endTime - startTime; | |
| 216 m_totalCommitTime += commitTime; | |
| 217 m_totalCommitCount++; | |
| 208 } | 218 } |
| 209 m_layerTreeHost->commitComplete(); | 219 m_layerTreeHost->commitComplete(); |
| 210 m_nextFrameIsNewlyCommittedFrame = true; | 220 m_nextFrameIsNewlyCommittedFrame = true; |
| 211 } | 221 } |
| 212 | 222 |
| 213 void CCSingleThreadProxy::setNeedsCommit() | 223 void CCSingleThreadProxy::setNeedsCommit() |
| 214 { | 224 { |
| 215 ASSERT(CCProxy::isMainThread()); | 225 ASSERT(CCProxy::isMainThread()); |
| 216 m_layerTreeHost->scheduleComposite(); | 226 m_layerTreeHost->scheduleComposite(); |
| 217 } | 227 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 | 343 |
| 334 void CCSingleThreadProxy::didSwapFrame() | 344 void CCSingleThreadProxy::didSwapFrame() |
| 335 { | 345 { |
| 336 if (m_nextFrameIsNewlyCommittedFrame) { | 346 if (m_nextFrameIsNewlyCommittedFrame) { |
| 337 m_nextFrameIsNewlyCommittedFrame = false; | 347 m_nextFrameIsNewlyCommittedFrame = false; |
| 338 m_layerTreeHost->didCommitAndDrawFrame(); | 348 m_layerTreeHost->didCommitAndDrawFrame(); |
| 339 } | 349 } |
| 340 } | 350 } |
| 341 | 351 |
| 342 } | 352 } |
| OLD | NEW |