| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 m_layerTreeHost->didLoseContext(); | 168 m_layerTreeHost->didLoseContext(); |
| 169 m_contextLost = true; | 169 m_contextLost = true; |
| 170 } | 170 } |
| 171 | 171 |
| 172 void CCSingleThreadProxy::setNeedsAnimate() | 172 void CCSingleThreadProxy::setNeedsAnimate() |
| 173 { | 173 { |
| 174 // CCThread-only feature | 174 // CCThread-only feature |
| 175 ASSERT_NOT_REACHED(); | 175 ASSERT_NOT_REACHED(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void CCSingleThreadProxy::doCommit(CCTextureUpdateQueue& queue) | 178 void CCSingleThreadProxy::doCommit(PassOwnPtr<CCTextureUpdateQueue> queue) |
| 179 { | 179 { |
| 180 ASSERT(CCProxy::isMainThread()); | 180 ASSERT(CCProxy::isMainThread()); |
| 181 // Commit immediately | 181 // Commit immediately |
| 182 { | 182 { |
| 183 DebugScopedSetMainThreadBlocked mainThreadBlocked; | 183 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 184 DebugScopedSetImplThread impl; | 184 DebugScopedSetImplThread impl; |
| 185 | 185 |
| 186 m_layerTreeHostImpl->beginCommit(); | 186 m_layerTreeHostImpl->beginCommit(); |
| 187 | 187 |
| 188 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); | 188 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); |
| 189 | 189 |
| 190 CCTextureUpdateController::updateTextures(m_layerTreeHostImpl->resourceP
rovider(), m_layerTreeHostImpl->resourceProvider()->textureUploader(), &queue); | 190 OwnPtr<CCTextureUpdateController> updateController = |
| 191 CCTextureUpdateController::create( |
| 192 NULL, |
| 193 CCProxy::mainThread(), |
| 194 queue, |
| 195 m_layerTreeHostImpl->resourceProvider(), |
| 196 m_layerTreeHostImpl->resourceProvider()->textureUploader()); |
| 197 updateController->finalize(); |
| 191 | 198 |
| 192 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); | 199 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); |
| 193 | 200 |
| 194 m_layerTreeHostImpl->commitComplete(); | 201 m_layerTreeHostImpl->commitComplete(); |
| 195 | 202 |
| 196 #if !ASSERT_DISABLED | 203 #if !ASSERT_DISABLED |
| 197 // In the single-threaded case, the scroll deltas should never be | 204 // In the single-threaded case, the scroll deltas should never be |
| 198 // touched on the impl layer tree. | 205 // touched on the impl layer tree. |
| 199 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->processScr
ollDeltas(); | 206 OwnPtr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->processScr
ollDeltas(); |
| 200 ASSERT(!scrollInfo->scrolls.size()); | 207 ASSERT(!scrollInfo->scrolls.size()); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 { | 312 { |
| 306 DebugScopedSetImplThread implThread; | 313 DebugScopedSetImplThread implThread; |
| 307 m_layerTreeHost->getEvictedContentTexturesBackings(evictedContentsTextur
esBackings); | 314 m_layerTreeHost->getEvictedContentTexturesBackings(evictedContentsTextur
esBackings); |
| 308 } | 315 } |
| 309 m_layerTreeHost->unlinkEvictedContentTexturesBackings(evictedContentsTexture
sBackings); | 316 m_layerTreeHost->unlinkEvictedContentTexturesBackings(evictedContentsTexture
sBackings); |
| 310 { | 317 { |
| 311 DebugScopedSetImplThreadAndMainThreadBlocked implAndMainBlocked; | 318 DebugScopedSetImplThreadAndMainThreadBlocked implAndMainBlocked; |
| 312 m_layerTreeHost->deleteEvictedContentTexturesBackings(); | 319 m_layerTreeHost->deleteEvictedContentTexturesBackings(); |
| 313 } | 320 } |
| 314 | 321 |
| 315 CCTextureUpdateQueue queue; | 322 OwnPtr<CCTextureUpdateQueue> queue = adoptPtr(new CCTextureUpdateQueue); |
| 316 m_layerTreeHost->updateLayers(queue, m_layerTreeHostImpl->memoryAllocationLi
mitBytes()); | 323 m_layerTreeHost->updateLayers(*(queue.get()), m_layerTreeHostImpl->memoryAll
ocationLimitBytes()); |
| 317 | 324 |
| 318 if (m_layerTreeHostImpl->contentsTexturesPurged()) | 325 if (m_layerTreeHostImpl->contentsTexturesPurged()) |
| 319 m_layerTreeHostImpl->resetContentsTexturesPurged(); | 326 m_layerTreeHostImpl->resetContentsTexturesPurged(); |
| 320 | 327 |
| 321 m_layerTreeHost->willCommit(); | 328 m_layerTreeHost->willCommit(); |
| 322 doCommit(queue); | 329 doCommit(queue.release()); |
| 323 bool result = doComposite(); | 330 bool result = doComposite(); |
| 324 m_layerTreeHost->didBeginFrame(); | 331 m_layerTreeHost->didBeginFrame(); |
| 325 return result; | 332 return result; |
| 326 } | 333 } |
| 327 | 334 |
| 328 bool CCSingleThreadProxy::doComposite() | 335 bool CCSingleThreadProxy::doComposite() |
| 329 { | 336 { |
| 330 ASSERT(!m_contextLost); | 337 ASSERT(!m_contextLost); |
| 331 { | 338 { |
| 332 DebugScopedSetImplThread impl; | 339 DebugScopedSetImplThread impl; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 361 | 368 |
| 362 void CCSingleThreadProxy::didSwapFrame() | 369 void CCSingleThreadProxy::didSwapFrame() |
| 363 { | 370 { |
| 364 if (m_nextFrameIsNewlyCommittedFrame) { | 371 if (m_nextFrameIsNewlyCommittedFrame) { |
| 365 m_nextFrameIsNewlyCommittedFrame = false; | 372 m_nextFrameIsNewlyCommittedFrame = false; |
| 366 m_layerTreeHost->didCommitAndDrawFrame(); | 373 m_layerTreeHost->didCommitAndDrawFrame(); |
| 367 } | 374 } |
| 368 } | 375 } |
| 369 | 376 |
| 370 } | 377 } |
| OLD | NEW |