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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 m_commitCompletionEventOnImplThread->signal(); | 554 m_commitCompletionEventOnImplThread->signal(); |
555 m_commitCompletionEventOnImplThread = 0; | 555 m_commitCompletionEventOnImplThread = 0; |
556 } | 556 } |
557 | 557 |
558 void CCThreadProxy::scheduledActionBeginContextRecreation() | 558 void CCThreadProxy::scheduledActionBeginContextRecreation() |
559 { | 559 { |
560 ASSERT(isImplThread()); | 560 ASSERT(isImplThread()); |
561 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginCo
ntextRecreation)); | 561 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginCo
ntextRecreation)); |
562 } | 562 } |
563 | 563 |
564 bool CCThreadProxy::scheduledActionDrawAndSwapInternal(bool forcedDraw) | 564 CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapInte
rnal(bool forcedDraw) |
565 { | 565 { |
566 TRACE_EVENT("CCThreadProxy::scheduledActionDrawAndSwap", this, 0); | 566 TRACE_EVENT("CCThreadProxy::scheduledActionDrawAndSwap", this, 0); |
| 567 CCScheduledActionDrawAndSwapResult result; |
| 568 result.didDraw = false; |
| 569 result.didSwap = false; |
567 ASSERT(isImplThread()); | 570 ASSERT(isImplThread()); |
568 ASSERT(m_layerTreeHostImpl); | 571 ASSERT(m_layerTreeHostImpl); |
569 if (!m_layerTreeHostImpl) | 572 if (!m_layerTreeHostImpl) |
570 return false; | 573 return result; |
571 | 574 |
572 // FIXME: compute the frame display time more intelligently | 575 // FIXME: compute the frame display time more intelligently |
573 double monotonicTime = monotonicallyIncreasingTime(); | 576 double monotonicTime = monotonicallyIncreasingTime(); |
574 double wallClockTime = currentTime(); | 577 double wallClockTime = currentTime(); |
575 | 578 |
576 m_inputHandlerOnImplThread->animate(monotonicTime); | 579 m_inputHandlerOnImplThread->animate(monotonicTime); |
577 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime); | 580 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime); |
578 CCLayerTreeHostImpl::FrameData frame; | 581 CCLayerTreeHostImpl::FrameData frame; |
579 bool drawFrame = m_layerTreeHostImpl->prepareToDraw(frame) || forcedDraw; | 582 bool drawFrame = m_layerTreeHostImpl->prepareToDraw(frame) || forcedDraw; |
580 if (drawFrame) | 583 if (drawFrame) { |
581 m_layerTreeHostImpl->drawLayers(frame); | 584 m_layerTreeHostImpl->drawLayers(frame); |
| 585 result.didDraw = true; |
| 586 } |
582 | 587 |
583 // Check for a pending compositeAndReadback. | 588 // Check for a pending compositeAndReadback. |
584 if (m_readbackRequestOnImplThread) { | 589 if (m_readbackRequestOnImplThread) { |
585 ASSERT(drawFrame); // This should be a forcedDraw | 590 ASSERT(drawFrame); // This should be a forcedDraw |
586 m_layerTreeHostImpl->readback(m_readbackRequestOnImplThread->pixels, m_r
eadbackRequestOnImplThread->rect); | 591 m_layerTreeHostImpl->readback(m_readbackRequestOnImplThread->pixels, m_r
eadbackRequestOnImplThread->rect); |
587 m_readbackRequestOnImplThread->success = !m_layerTreeHostImpl->isContext
Lost(); | 592 m_readbackRequestOnImplThread->success = !m_layerTreeHostImpl->isContext
Lost(); |
588 m_readbackRequestOnImplThread->completion.signal(); | 593 m_readbackRequestOnImplThread->completion.signal(); |
589 m_readbackRequestOnImplThread = 0; | 594 m_readbackRequestOnImplThread = 0; |
590 } | 595 } |
591 | 596 |
592 if (drawFrame) | 597 if (drawFrame) |
593 m_layerTreeHostImpl->swapBuffers(); | 598 result.didSwap = m_layerTreeHostImpl->swapBuffers(); |
594 | 599 |
595 // Process any finish request | 600 // Process any finish request |
596 if (m_finishAllRenderingCompletionEventOnImplThread) { | 601 if (m_finishAllRenderingCompletionEventOnImplThread) { |
597 ASSERT(drawFrame); // This should be a forcedDraw | 602 ASSERT(drawFrame); // This should be a forcedDraw |
598 m_layerTreeHostImpl->finishAllRendering(); | 603 m_layerTreeHostImpl->finishAllRendering(); |
599 m_finishAllRenderingCompletionEventOnImplThread->signal(); | 604 m_finishAllRenderingCompletionEventOnImplThread->signal(); |
600 m_finishAllRenderingCompletionEventOnImplThread = 0; | 605 m_finishAllRenderingCompletionEventOnImplThread = 0; |
601 } | 606 } |
602 | 607 |
603 // Tell the main thread that the the newly-commited frame was drawn. | 608 // Tell the main thread that the the newly-commited frame was drawn. |
604 if (m_nextFrameIsNewlyCommittedFrameOnImplThread) { | 609 if (m_nextFrameIsNewlyCommittedFrameOnImplThread) { |
605 m_nextFrameIsNewlyCommittedFrameOnImplThread = false; | 610 m_nextFrameIsNewlyCommittedFrameOnImplThread = false; |
606 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::did
CommitAndDrawFrame)); | 611 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::did
CommitAndDrawFrame)); |
607 } | 612 } |
608 | 613 |
609 ASSERT(drawFrame || (!drawFrame && !forcedDraw)); | 614 ASSERT(drawFrame || (!drawFrame && !forcedDraw)); |
610 return drawFrame; | 615 return result; |
611 } | 616 } |
612 | 617 |
613 bool CCThreadProxy::scheduledActionDrawAndSwapIfPossible() | 618 CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapIfPo
ssible() |
614 { | 619 { |
615 return scheduledActionDrawAndSwapInternal(false); | 620 return scheduledActionDrawAndSwapInternal(false); |
616 } | 621 } |
617 | 622 |
618 void CCThreadProxy::scheduledActionDrawAndSwapForced() | 623 CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapForc
ed() |
619 { | 624 { |
620 scheduledActionDrawAndSwapInternal(true); | 625 return scheduledActionDrawAndSwapInternal(true); |
621 } | 626 } |
622 | 627 |
623 void CCThreadProxy::didCommitAndDrawFrame() | 628 void CCThreadProxy::didCommitAndDrawFrame() |
624 { | 629 { |
625 ASSERT(isMainThread()); | 630 ASSERT(isMainThread()); |
626 if (!m_layerTreeHost) | 631 if (!m_layerTreeHost) |
627 return; | 632 return; |
628 m_layerTreeHost->didCommitAndDrawFrame(); | 633 m_layerTreeHost->didCommitAndDrawFrame(); |
629 } | 634 } |
630 | 635 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->con
tentsTextureAllocator()); | 757 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->con
tentsTextureAllocator()); |
753 *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptRef(c
ontextPtr)); | 758 *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptRef(c
ontextPtr)); |
754 if (*recreateSucceeded) { | 759 if (*recreateSucceeded) { |
755 *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); | 760 *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); |
756 m_schedulerOnImplThread->didRecreateContext(); | 761 m_schedulerOnImplThread->didRecreateContext(); |
757 } | 762 } |
758 completion->signal(); | 763 completion->signal(); |
759 } | 764 } |
760 | 765 |
761 } // namespace WebCore | 766 } // namespace WebCore |
OLD | NEW |