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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 { | 298 { |
299 { | 299 { |
300 DebugScopedSetImplThread impl; | 300 DebugScopedSetImplThread impl; |
301 if (m_rendererInitialized) | 301 if (m_rendererInitialized) |
302 m_layerTreeHostImpl->renderer()->doNoOp(); | 302 m_layerTreeHostImpl->renderer()->doNoOp(); |
303 } | 303 } |
304 } | 304 } |
305 | 305 |
306 void CCSingleThreadProxy::onSwapBuffersCompleteOnImplThread() | 306 void CCSingleThreadProxy::onSwapBuffersCompleteOnImplThread() |
307 { | 307 { |
308 ASSERT_NOT_REACHED(); | 308 //ASSERT_NOT_REACHED(); |
309 } | 309 } |
310 | 310 |
311 bool CCSingleThreadProxy::commitAndComposite() | 311 bool CCSingleThreadProxy::commitAndComposite() |
312 { | 312 { |
313 ASSERT(CCProxy::isMainThread()); | 313 ASSERT(CCProxy::isMainThread()); |
314 | 314 |
315 if (!m_layerTreeHost->initializeRendererIfNeeded()) | 315 if (!m_layerTreeHost->initializeRendererIfNeeded()) |
316 return false; | 316 return false; |
317 | 317 |
318 // Unlink any texture backings that were deleted | 318 // Unlink any texture backings that were deleted |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 // We guard prepareToDraw() with canDraw() because it always returns a v
alid frame, so can only | 356 // We guard prepareToDraw() with canDraw() because it always returns a v
alid frame, so can only |
357 // be used when such a frame is possible. Since drawLayers() depends on
the result of | 357 // be used when such a frame is possible. Since drawLayers() depends on
the result of |
358 // prepareToDraw(), it is guarded on canDraw() as well. | 358 // prepareToDraw(), it is guarded on canDraw() as well. |
359 if (!m_layerTreeHostImpl->canDraw()) | 359 if (!m_layerTreeHostImpl->canDraw()) |
360 return false; | 360 return false; |
361 | 361 |
362 CCLayerTreeHostImpl::FrameData frame; | 362 CCLayerTreeHostImpl::FrameData frame; |
363 m_layerTreeHostImpl->prepareToDraw(frame); | 363 m_layerTreeHostImpl->prepareToDraw(frame); |
364 m_layerTreeHostImpl->drawLayers(frame); | 364 m_layerTreeHostImpl->drawLayers(frame); |
365 m_layerTreeHostImpl->didDrawAllLayers(frame); | 365 m_layerTreeHostImpl->didDrawAllLayers(frame); |
| 366 m_contextLost = m_layerTreeHostImpl->isContextLost(); |
366 } | 367 } |
367 | 368 |
368 if (m_layerTreeHostImpl->isContextLost()) { | 369 if (m_contextLost) { |
369 m_contextLost = true; | |
370 m_layerTreeHost->didLoseContext(); | 370 m_layerTreeHost->didLoseContext(); |
371 return false; | 371 return false; |
372 } | 372 } |
373 | 373 |
374 return true; | 374 return true; |
375 } | 375 } |
376 | 376 |
377 void CCSingleThreadProxy::didSwapFrame() | 377 void CCSingleThreadProxy::didSwapFrame() |
378 { | 378 { |
379 if (m_nextFrameIsNewlyCommittedFrame) { | 379 if (m_nextFrameIsNewlyCommittedFrame) { |
380 m_nextFrameIsNewlyCommittedFrame = false; | 380 m_nextFrameIsNewlyCommittedFrame = false; |
381 m_layerTreeHost->didCommitAndDrawFrame(); | 381 m_layerTreeHost->didCommitAndDrawFrame(); |
382 } | 382 } |
383 } | 383 } |
384 | 384 |
385 } | 385 } |
OLD | NEW |