OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 return doComposite(); | 318 return doComposite(); |
319 } | 319 } |
320 | 320 |
321 bool CCSingleThreadProxy::doComposite() | 321 bool CCSingleThreadProxy::doComposite() |
322 { | 322 { |
323 ASSERT(!m_contextLost); | 323 ASSERT(!m_contextLost); |
324 { | 324 { |
325 DebugScopedSetImplThread impl; | 325 DebugScopedSetImplThread impl; |
326 double monotonicTime = monotonicallyIncreasingTime(); | 326 double monotonicTime = monotonicallyIncreasingTime(); |
327 double wallClockTime = currentTime(); | 327 double wallClockTime = currentTime(); |
| 328 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime); |
328 | 329 |
329 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime); | 330 // We guard prepareToDraw() with canDraw() because it always returns a val
id frame, so can only |
| 331 // be used when such a frame is possible. Since drawLayers() depends on th
e result of |
| 332 // prepareToDraw(), it is guarded on canDraw() as well. |
| 333 if (!m_layerTreeHostImpl->canDraw()) |
| 334 return false; |
| 335 |
330 CCLayerTreeHostImpl::FrameData frame; | 336 CCLayerTreeHostImpl::FrameData frame; |
331 m_layerTreeHostImpl->prepareToDraw(frame); | 337 m_layerTreeHostImpl->prepareToDraw(frame); |
332 m_layerTreeHostImpl->drawLayers(frame); | 338 m_layerTreeHostImpl->drawLayers(frame); |
333 m_layerTreeHostImpl->didDrawAllLayers(frame); | 339 m_layerTreeHostImpl->didDrawAllLayers(frame); |
334 } | 340 } |
335 | 341 |
336 if (m_layerTreeHostImpl->isContextLost()) { | 342 if (m_layerTreeHostImpl->isContextLost()) { |
337 m_contextLost = true; | 343 m_contextLost = true; |
338 m_layerTreeHost->didLoseContext(); | 344 m_layerTreeHost->didLoseContext(); |
339 return false; | 345 return false; |
340 } | 346 } |
341 | 347 |
342 return true; | 348 return true; |
343 } | 349 } |
344 | 350 |
345 void CCSingleThreadProxy::didSwapFrame() | 351 void CCSingleThreadProxy::didSwapFrame() |
346 { | 352 { |
347 if (m_nextFrameIsNewlyCommittedFrame) { | 353 if (m_nextFrameIsNewlyCommittedFrame) { |
348 m_nextFrameIsNewlyCommittedFrame = false; | 354 m_nextFrameIsNewlyCommittedFrame = false; |
349 m_layerTreeHost->didCommitAndDrawFrame(); | 355 m_layerTreeHost->didCommitAndDrawFrame(); |
350 } | 356 } |
351 } | 357 } |
352 | 358 |
353 } | 359 } |
OLD | NEW |