| 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" |
| 11 #include "CCLayerTreeHost.h" | 11 #include "CCLayerTreeHost.h" |
| 12 #include "CCTextureUpdateController.h" | 12 #include "CCTextureUpdateController.h" |
| 13 #include "CCTimer.h" | 13 #include "CCTimer.h" |
| 14 #include "TraceEvent.h" | 14 #include "TraceEvent.h" |
| 15 #include <wtf/CurrentTime.h> | 15 #include <wtf/CurrentTime.h> |
| 16 | 16 |
| 17 using namespace WTF; | 17 using namespace WTF; |
| 18 | 18 |
| 19 namespace { |
| 20 |
| 21 // We don't need to split texture uploads into multiple batches if we are single
threaded. |
| 22 const size_t maxTextureUpdates = std::numeric_limits<size_t>::max(); |
| 23 |
| 24 } |
| 25 |
| 19 namespace WebCore { | 26 namespace WebCore { |
| 20 | 27 |
| 21 PassOwnPtr<CCProxy> CCSingleThreadProxy::create(CCLayerTreeHost* layerTreeHost) | 28 PassOwnPtr<CCProxy> CCSingleThreadProxy::create(CCLayerTreeHost* layerTreeHost) |
| 22 { | 29 { |
| 23 return adoptPtr(new CCSingleThreadProxy(layerTreeHost)); | 30 return adoptPtr(new CCSingleThreadProxy(layerTreeHost)); |
| 24 } | 31 } |
| 25 | 32 |
| 26 CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost) | 33 CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost) |
| 27 : m_layerTreeHost(layerTreeHost) | 34 : m_layerTreeHost(layerTreeHost) |
| 28 , m_contextLost(false) | 35 , m_contextLost(false) |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 m_layerTreeHostImpl->beginCommit(); | 193 m_layerTreeHostImpl->beginCommit(); |
| 187 | 194 |
| 188 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); | 195 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); |
| 189 | 196 |
| 190 // CCTextureUpdateController::updateTextures is non-blocking and will | 197 // CCTextureUpdateController::updateTextures is non-blocking and will |
| 191 // return without updating any textures if the uploader is busy. This | 198 // 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 | 199 // 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 | 200 // single thread mode. For correctness, loop until no more updates are |
| 194 // pending. | 201 // pending. |
| 195 while (queue.hasMoreUpdates()) | 202 while (queue.hasMoreUpdates()) |
| 196 CCTextureUpdateController::updateTextures(m_layerTreeHostImpl->resou
rceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHost
Impl->renderer()->textureUploader(), &queue, maxPartialTextureUpdates()); | 203 CCTextureUpdateController::updateTextures(m_layerTreeHostImpl->resou
rceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHost
Impl->renderer()->textureUploader(), &queue, maxTextureUpdates); |
| 197 | 204 |
| 198 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); | 205 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); |
| 199 | 206 |
| 200 m_layerTreeHostImpl->commitComplete(); | 207 m_layerTreeHostImpl->commitComplete(); |
| 201 | 208 |
| 202 #if !ASSERT_DISABLED | 209 #if !ASSERT_DISABLED |
| 203 // In the single-threaded case, the scroll deltas should never be | 210 // In the single-threaded case, the scroll deltas should never be |
| 204 // touched on the impl layer tree. | 211 // touched on the impl layer tree. |
| 205 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->processScr
ollDeltas(); | 212 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->processScr
ollDeltas(); |
| 206 ASSERT(!scrollInfo->scrolls.size()); | 213 ASSERT(!scrollInfo->scrolls.size()); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 if (!m_layerTreeHost->initializeRendererIfNeeded()) | 287 if (!m_layerTreeHost->initializeRendererIfNeeded()) |
| 281 return false; | 288 return false; |
| 282 | 289 |
| 283 if (m_layerTreeHostImpl->contentsTexturesPurged()) { | 290 if (m_layerTreeHostImpl->contentsTexturesPurged()) { |
| 284 m_layerTreeHost->unlinkAllContentTextures(); | 291 m_layerTreeHost->unlinkAllContentTextures(); |
| 285 DebugScopedSetImplThreadAndMainThreadBlocked implAndMainBlocked; | 292 DebugScopedSetImplThreadAndMainThreadBlocked implAndMainBlocked; |
| 286 m_layerTreeHost->deleteUnlinkedTextures(); | 293 m_layerTreeHost->deleteUnlinkedTextures(); |
| 287 } | 294 } |
| 288 | 295 |
| 289 CCTextureUpdateQueue queue; | 296 CCTextureUpdateQueue queue; |
| 290 m_layerTreeHost->updateLayers(queue, m_layerTreeHostImpl->memoryAllocationLi
mitBytes()); | 297 m_layerTreeHost->updateLayers(queue, m_layerTreeHostImpl->memoryAllocationLi
mitBytes(), maxTextureUpdates); |
| 291 m_layerTreeHostImpl->resetContentsTexturesPurged(); | 298 m_layerTreeHostImpl->resetContentsTexturesPurged(); |
| 292 | 299 |
| 293 m_layerTreeHost->willCommit(); | 300 m_layerTreeHost->willCommit(); |
| 294 doCommit(queue); | 301 doCommit(queue); |
| 295 bool result = doComposite(); | 302 bool result = doComposite(); |
| 296 m_layerTreeHost->didBeginFrame(); | 303 m_layerTreeHost->didBeginFrame(); |
| 297 return result; | 304 return result; |
| 298 } | 305 } |
| 299 | 306 |
| 300 bool CCSingleThreadProxy::doComposite() | 307 bool CCSingleThreadProxy::doComposite() |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 340 |
| 334 void CCSingleThreadProxy::didSwapFrame() | 341 void CCSingleThreadProxy::didSwapFrame() |
| 335 { | 342 { |
| 336 if (m_nextFrameIsNewlyCommittedFrame) { | 343 if (m_nextFrameIsNewlyCommittedFrame) { |
| 337 m_nextFrameIsNewlyCommittedFrame = false; | 344 m_nextFrameIsNewlyCommittedFrame = false; |
| 338 m_layerTreeHost->didCommitAndDrawFrame(); | 345 m_layerTreeHost->didCommitAndDrawFrame(); |
| 339 } | 346 } |
| 340 } | 347 } |
| 341 | 348 |
| 342 } | 349 } |
| OLD | NEW |