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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 // We guard prepareToDraw() with canDraw() because it always returns a v
alid frame, so can only | 314 // We guard prepareToDraw() with canDraw() because it always returns a v
alid frame, so can only |
315 // be used when such a frame is possible. Since drawLayers() depends on
the result of | 315 // be used when such a frame is possible. Since drawLayers() depends on
the result of |
316 // prepareToDraw(), it is guarded on canDraw() as well. | 316 // prepareToDraw(), it is guarded on canDraw() as well. |
317 if (!m_layerTreeHostImpl->canDraw()) | 317 if (!m_layerTreeHostImpl->canDraw()) |
318 return false; | 318 return false; |
319 | 319 |
320 CCLayerTreeHostImpl::FrameData frame; | 320 CCLayerTreeHostImpl::FrameData frame; |
321 m_layerTreeHostImpl->prepareToDraw(frame); | 321 m_layerTreeHostImpl->prepareToDraw(frame); |
322 m_layerTreeHostImpl->drawLayers(frame); | 322 m_layerTreeHostImpl->drawLayers(frame); |
323 m_layerTreeHostImpl->didDrawAllLayers(frame); | 323 m_layerTreeHostImpl->didDrawAllLayers(frame); |
| 324 m_contextLost = m_layerTreeHostImpl->isContextLost(); |
324 } | 325 } |
325 | 326 |
326 if (m_layerTreeHostImpl->isContextLost()) { | 327 if (m_contextLost) { |
327 m_contextLost = true; | |
328 m_layerTreeHost->didLoseContext(); | 328 m_layerTreeHost->didLoseContext(); |
329 return false; | 329 return false; |
330 } | 330 } |
331 | 331 |
332 return true; | 332 return true; |
333 } | 333 } |
334 | 334 |
335 void CCSingleThreadProxy::didSwapFrame() | 335 void CCSingleThreadProxy::didSwapFrame() |
336 { | 336 { |
337 if (m_nextFrameIsNewlyCommittedFrame) { | 337 if (m_nextFrameIsNewlyCommittedFrame) { |
338 m_nextFrameIsNewlyCommittedFrame = false; | 338 m_nextFrameIsNewlyCommittedFrame = false; |
339 m_layerTreeHost->didCommitAndDrawFrame(); | 339 m_layerTreeHost->didCommitAndDrawFrame(); |
340 } | 340 } |
341 } | 341 } |
342 | 342 |
343 } | 343 } |
OLD | NEW |