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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 // TODO(aelias): Hardcoding the first child here is weird. Think of | 373 // TODO(aelias): Hardcoding the first child here is weird. Think of |
374 // a cleaner way to get the contentBounds on the Impl side. | 374 // a cleaner way to get the contentBounds on the Impl side. |
375 if (!m_scrollLayerImpl || m_scrollLayerImpl->children().isEmpty()) | 375 if (!m_scrollLayerImpl || m_scrollLayerImpl->children().isEmpty()) |
376 return IntSize(); | 376 return IntSize(); |
377 return m_scrollLayerImpl->children()[0]->contentBounds(); | 377 return m_scrollLayerImpl->children()[0]->contentBounds(); |
378 } | 378 } |
379 | 379 |
380 bool CCLayerTreeHostImpl::prepareToDraw(FrameData& frame) | 380 bool CCLayerTreeHostImpl::prepareToDraw(FrameData& frame) |
381 { | 381 { |
382 TRACE_EVENT("CCLayerTreeHostImpl::prepareToDraw", this, 0); | 382 TRACE_EVENT("CCLayerTreeHostImpl::prepareToDraw", this, 0); |
| 383 ASSERT(canDraw()); |
383 | 384 |
384 frame.renderPasses.clear(); | 385 frame.renderPasses.clear(); |
385 frame.renderSurfaceLayerList.clear(); | 386 frame.renderSurfaceLayerList.clear(); |
386 | 387 |
387 if (!m_rootLayerImpl) | |
388 return false; | |
389 | |
390 if (!calculateRenderPasses(frame.renderPasses, frame.renderSurfaceLayerList)
) { | 388 if (!calculateRenderPasses(frame.renderPasses, frame.renderSurfaceLayerList)
) { |
391 // We're missing textures on an animating layer. Request a commit. | 389 // We're missing textures on an animating layer. Request a commit. |
392 m_client->setNeedsCommitOnImplThread(); | 390 m_client->setNeedsCommitOnImplThread(); |
393 return false; | 391 return false; |
394 } | 392 } |
395 | 393 |
396 // If we return true, then we expect drawLayers() to be called before this f
unction is called again. | 394 // If we return true, then we expect drawLayers() to be called before this f
unction is called again. |
397 return true; | 395 return true; |
398 } | 396 } |
399 | 397 |
400 void CCLayerTreeHostImpl::setContentsMemoryAllocationLimitBytes(size_t bytes) | 398 void CCLayerTreeHostImpl::setContentsMemoryAllocationLimitBytes(size_t bytes) |
401 { | 399 { |
402 m_client->postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread(
bytes); | 400 m_client->postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread(
bytes); |
403 } | 401 } |
404 | 402 |
405 void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) | 403 void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) |
406 { | 404 { |
407 TRACE_EVENT("CCLayerTreeHostImpl::drawLayers", this, 0); | 405 TRACE_EVENT("CCLayerTreeHostImpl::drawLayers", this, 0); |
408 ASSERT(m_layerRenderer); | 406 ASSERT(canDraw()); |
409 | |
410 if (!m_rootLayerImpl) | |
411 return; | |
412 | 407 |
413 // FIXME: use the frame begin time from the overall compositor scheduler. | 408 // FIXME: use the frame begin time from the overall compositor scheduler. |
414 // This value is currently inaccessible because it is up in Chromium's | 409 // This value is currently inaccessible because it is up in Chromium's |
415 // RenderWidget. | 410 // RenderWidget. |
416 | 411 |
417 m_fpsCounter->markBeginningOfFrame(currentTime()); | 412 m_fpsCounter->markBeginningOfFrame(currentTime()); |
418 m_layerRenderer->beginDrawingFrame(m_rootLayerImpl->renderSurface()); | 413 m_layerRenderer->beginDrawingFrame(m_rootLayerImpl->renderSurface()); |
419 | 414 |
420 for (size_t i = 0; i < frame.renderPasses.size(); ++i) | 415 for (size_t i = 0; i < frame.renderPasses.size(); ++i) |
421 m_layerRenderer->drawRenderPass(frame.renderPasses[i].get()); | 416 m_layerRenderer->drawRenderPass(frame.renderPasses[i].get()); |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 return; | 904 return; |
910 | 905 |
911 bool isContinuing = m_activeGestureAnimation->animate(monotonicTime); | 906 bool isContinuing = m_activeGestureAnimation->animate(monotonicTime); |
912 if (isContinuing) | 907 if (isContinuing) |
913 m_client->setNeedsRedrawOnImplThread(); | 908 m_client->setNeedsRedrawOnImplThread(); |
914 else | 909 else |
915 m_activeGestureAnimation.clear(); | 910 m_activeGestureAnimation.clear(); |
916 } | 911 } |
917 | 912 |
918 } // namespace WebCore | 913 } // namespace WebCore |
OLD | NEW |