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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 { | 182 { |
183 ASSERT(CCProxy::isMainThread()); | 183 ASSERT(CCProxy::isMainThread()); |
184 // Commit immediately | 184 // Commit immediately |
185 { | 185 { |
186 DebugScopedSetMainThreadBlocked mainThreadBlocked; | 186 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
187 DebugScopedSetImplThread impl; | 187 DebugScopedSetImplThread impl; |
188 | 188 |
189 base::TimeTicks startTime = base::TimeTicks::HighResNow(); | 189 base::TimeTicks startTime = base::TimeTicks::HighResNow(); |
190 m_layerTreeHostImpl->beginCommit(); | 190 m_layerTreeHostImpl->beginCommit(); |
191 | 191 |
| 192 m_layerTreeHost->contentsTextureManager()->pushTexturePrioritiesToBackin
gs(); |
192 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); | 193 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); |
193 | 194 |
194 OwnPtr<CCTextureUpdateController> updateController = | 195 OwnPtr<CCTextureUpdateController> updateController = |
195 CCTextureUpdateController::create( | 196 CCTextureUpdateController::create( |
196 NULL, | 197 NULL, |
197 CCProxy::mainThread(), | 198 CCProxy::mainThread(), |
198 queue, | 199 queue, |
199 m_layerTreeHostImpl->resourceProvider(), | 200 m_layerTreeHostImpl->resourceProvider(), |
200 m_layerTreeHostImpl->resourceProvider()->textureUploader()); | 201 m_layerTreeHostImpl->resourceProvider()->textureUploader()); |
201 updateController->finalize(); | 202 updateController->finalize(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(PassOwnPtr
<CCAnimationEventsVector> events, double wallClockTime) | 276 void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(PassOwnPtr
<CCAnimationEventsVector> events, double wallClockTime) |
276 { | 277 { |
277 ASSERT(CCProxy::isImplThread()); | 278 ASSERT(CCProxy::isImplThread()); |
278 DebugScopedSetMainThread main; | 279 DebugScopedSetMainThread main; |
279 m_layerTreeHost->setAnimationEvents(events, wallClockTime); | 280 m_layerTreeHost->setAnimationEvents(events, wallClockTime); |
280 } | 281 } |
281 | 282 |
282 void CCSingleThreadProxy::releaseContentsTexturesOnImplThread() | 283 void CCSingleThreadProxy::releaseContentsTexturesOnImplThread() |
283 { | 284 { |
284 ASSERT(isImplThread()); | 285 ASSERT(isImplThread()); |
285 m_layerTreeHost->reduceContentsTexturesMemoryOnImplThread(0, m_layerTreeHost
Impl->resourceProvider()); | 286 if (m_layerTreeHost->contentsTextureManager()) |
| 287 m_layerTreeHost->contentsTextureManager()->reduceMemoryOnImplThread(0, m
_layerTreeHostImpl->resourceProvider()); |
286 } | 288 } |
287 | 289 |
288 // Called by the legacy scheduling path (e.g. where render_widget does the sched
uling) | 290 // Called by the legacy scheduling path (e.g. where render_widget does the sched
uling) |
289 void CCSingleThreadProxy::compositeImmediately() | 291 void CCSingleThreadProxy::compositeImmediately() |
290 { | 292 { |
291 if (commitAndComposite()) { | 293 if (commitAndComposite()) { |
292 m_layerTreeHostImpl->swapBuffers(); | 294 m_layerTreeHostImpl->swapBuffers(); |
293 didSwapFrame(); | 295 didSwapFrame(); |
294 } | 296 } |
295 } | 297 } |
(...skipping 16 matching lines...) Expand all Loading... |
312 { | 314 { |
313 ASSERT(CCProxy::isMainThread()); | 315 ASSERT(CCProxy::isMainThread()); |
314 | 316 |
315 if (!m_layerTreeHost->initializeRendererIfNeeded()) | 317 if (!m_layerTreeHost->initializeRendererIfNeeded()) |
316 return false; | 318 return false; |
317 | 319 |
318 // Unlink any texture backings that were deleted | 320 // Unlink any texture backings that were deleted |
319 CCPrioritizedTextureManager::BackingVector evictedContentsTexturesBackings; | 321 CCPrioritizedTextureManager::BackingVector evictedContentsTexturesBackings; |
320 { | 322 { |
321 DebugScopedSetImplThread implThread; | 323 DebugScopedSetImplThread implThread; |
322 m_layerTreeHost->getEvictedContentTexturesBackings(evictedContentsTextur
esBackings); | 324 m_layerTreeHost->contentsTextureManager()->getEvictedBackings(evictedCon
tentsTexturesBackings); |
323 } | 325 } |
324 m_layerTreeHost->unlinkEvictedContentTexturesBackings(evictedContentsTexture
sBackings); | 326 m_layerTreeHost->contentsTextureManager()->unlinkEvictedBackings(evictedCont
entsTexturesBackings); |
325 { | |
326 DebugScopedSetImplThreadAndMainThreadBlocked implAndMainBlocked; | |
327 m_layerTreeHost->deleteEvictedContentTexturesBackings(); | |
328 } | |
329 | 327 |
330 OwnPtr<CCTextureUpdateQueue> queue = adoptPtr(new CCTextureUpdateQueue); | 328 OwnPtr<CCTextureUpdateQueue> queue = adoptPtr(new CCTextureUpdateQueue); |
331 m_layerTreeHost->updateLayers(*(queue.get()), m_layerTreeHostImpl->memoryAll
ocationLimitBytes()); | 329 m_layerTreeHost->updateLayers(*(queue.get()), m_layerTreeHostImpl->memoryAll
ocationLimitBytes()); |
332 | 330 |
333 if (m_layerTreeHostImpl->contentsTexturesPurged()) | 331 if (m_layerTreeHostImpl->contentsTexturesPurged()) |
334 m_layerTreeHostImpl->resetContentsTexturesPurged(); | 332 m_layerTreeHostImpl->resetContentsTexturesPurged(); |
335 | 333 |
336 m_layerTreeHost->willCommit(); | 334 m_layerTreeHost->willCommit(); |
337 doCommit(queue.release()); | 335 doCommit(queue.release()); |
338 bool result = doComposite(); | 336 bool result = doComposite(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 374 |
377 void CCSingleThreadProxy::didSwapFrame() | 375 void CCSingleThreadProxy::didSwapFrame() |
378 { | 376 { |
379 if (m_nextFrameIsNewlyCommittedFrame) { | 377 if (m_nextFrameIsNewlyCommittedFrame) { |
380 m_nextFrameIsNewlyCommittedFrame = false; | 378 m_nextFrameIsNewlyCommittedFrame = false; |
381 m_layerTreeHost->didCommitAndDrawFrame(); | 379 m_layerTreeHost->didCommitAndDrawFrame(); |
382 } | 380 } |
383 } | 381 } |
384 | 382 |
385 } | 383 } |
OLD | NEW |