| 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 248     m_layerTreeHost = 0; | 248     m_layerTreeHost = 0; | 
| 249 } | 249 } | 
| 250 | 250 | 
| 251 void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(PassOwnPtr
     <CCAnimationEventsVector> events, double wallClockTime) | 251 void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(PassOwnPtr
     <CCAnimationEventsVector> events, double wallClockTime) | 
| 252 { | 252 { | 
| 253     ASSERT(CCProxy::isImplThread()); | 253     ASSERT(CCProxy::isImplThread()); | 
| 254     DebugScopedSetMainThread main; | 254     DebugScopedSetMainThread main; | 
| 255     m_layerTreeHost->setAnimationEvents(events, wallClockTime); | 255     m_layerTreeHost->setAnimationEvents(events, wallClockTime); | 
| 256 } | 256 } | 
| 257 | 257 | 
|  | 258 void CCSingleThreadProxy::releaseContentsTexturesOnImplThread() | 
|  | 259 { | 
|  | 260     ASSERT(isImplThread()); | 
|  | 261     m_layerTreeHost->reduceContentsTexturesMemoryOnImplThread(0, m_layerTreeHost
     Impl->resourceProvider()); | 
|  | 262 } | 
|  | 263 | 
| 258 // Called by the legacy scheduling path (e.g. where render_widget does the sched
     uling) | 264 // Called by the legacy scheduling path (e.g. where render_widget does the sched
     uling) | 
| 259 void CCSingleThreadProxy::compositeImmediately() | 265 void CCSingleThreadProxy::compositeImmediately() | 
| 260 { | 266 { | 
| 261     if (commitAndComposite()) { | 267     if (commitAndComposite()) { | 
| 262         m_layerTreeHostImpl->swapBuffers(); | 268         m_layerTreeHostImpl->swapBuffers(); | 
| 263         didSwapFrame(); | 269         didSwapFrame(); | 
| 264     } | 270     } | 
| 265 } | 271 } | 
| 266 | 272 | 
| 267 void CCSingleThreadProxy::forceSerializeOnSwapBuffers() | 273 void CCSingleThreadProxy::forceSerializeOnSwapBuffers() | 
| 268 { | 274 { | 
| 269     { | 275     { | 
| 270         DebugScopedSetImplThread impl; | 276         DebugScopedSetImplThread impl; | 
| 271         if (m_rendererInitialized) | 277         if (m_rendererInitialized) | 
| 272             m_layerTreeHostImpl->renderer()->doNoOp(); | 278             m_layerTreeHostImpl->renderer()->doNoOp(); | 
| 273     } | 279     } | 
| 274 } | 280 } | 
| 275 | 281 | 
| 276 bool CCSingleThreadProxy::commitAndComposite() | 282 bool CCSingleThreadProxy::commitAndComposite() | 
| 277 { | 283 { | 
| 278     ASSERT(CCProxy::isMainThread()); | 284     ASSERT(CCProxy::isMainThread()); | 
| 279 | 285 | 
| 280     if (!m_layerTreeHost->initializeRendererIfNeeded()) | 286     if (!m_layerTreeHost->initializeRendererIfNeeded()) | 
| 281         return false; | 287         return false; | 
| 282 | 288 | 
| 283     if (m_layerTreeHostImpl->contentsTexturesPurged()) { | 289     // Unlink any texture backings that were deleted | 
| 284         m_layerTreeHost->unlinkAllContentTextures(); | 290     CCPrioritizedTextureManager::BackingVector evictedContentsTexturesBackings; | 
|  | 291     { | 
|  | 292         DebugScopedSetImplThread implThread; | 
|  | 293         m_layerTreeHost->getEvictedContentTexturesBackings(evictedContentsTextur
     esBackings); | 
|  | 294     } | 
|  | 295     m_layerTreeHost->unlinkEvictedContentTexturesBackings(evictedContentsTexture
     sBackings); | 
|  | 296     { | 
| 285         DebugScopedSetImplThreadAndMainThreadBlocked implAndMainBlocked; | 297         DebugScopedSetImplThreadAndMainThreadBlocked implAndMainBlocked; | 
| 286         m_layerTreeHost->deleteUnlinkedTextures(); | 298         m_layerTreeHost->deleteEvictedContentTexturesBackings(); | 
| 287     } | 299     } | 
| 288 | 300 | 
| 289     CCTextureUpdateQueue queue; | 301     CCTextureUpdateQueue queue; | 
| 290     m_layerTreeHost->updateLayers(queue, m_layerTreeHostImpl->memoryAllocationLi
     mitBytes()); | 302     m_layerTreeHost->updateLayers(queue, m_layerTreeHostImpl->memoryAllocationLi
     mitBytes()); | 
| 291     m_layerTreeHostImpl->resetContentsTexturesPurged(); | 303 | 
|  | 304     if (m_layerTreeHostImpl->contentsTexturesPurged()) | 
|  | 305         m_layerTreeHostImpl->resetContentsTexturesPurged(); | 
| 292 | 306 | 
| 293     m_layerTreeHost->willCommit(); | 307     m_layerTreeHost->willCommit(); | 
| 294     doCommit(queue); | 308     doCommit(queue); | 
| 295     bool result = doComposite(); | 309     bool result = doComposite(); | 
| 296     m_layerTreeHost->didBeginFrame(); | 310     m_layerTreeHost->didBeginFrame(); | 
| 297     return result; | 311     return result; | 
| 298 } | 312 } | 
| 299 | 313 | 
| 300 bool CCSingleThreadProxy::doComposite() | 314 bool CCSingleThreadProxy::doComposite() | 
| 301 { | 315 { | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 333 | 347 | 
| 334 void CCSingleThreadProxy::didSwapFrame() | 348 void CCSingleThreadProxy::didSwapFrame() | 
| 335 { | 349 { | 
| 336     if (m_nextFrameIsNewlyCommittedFrame) { | 350     if (m_nextFrameIsNewlyCommittedFrame) { | 
| 337         m_nextFrameIsNewlyCommittedFrame = false; | 351         m_nextFrameIsNewlyCommittedFrame = false; | 
| 338         m_layerTreeHost->didCommitAndDrawFrame(); | 352         m_layerTreeHost->didCommitAndDrawFrame(); | 
| 339     } | 353     } | 
| 340 } | 354 } | 
| 341 | 355 | 
| 342 } | 356 } | 
| OLD | NEW | 
|---|