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 "cc/trees/single_thread_proxy.h" | 5 #include "cc/trees/single_thread_proxy.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "cc/debug/benchmark_instrumentation.h" | 9 #include "cc/debug/benchmark_instrumentation.h" |
10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
525 | 525 |
526 // We guard PrepareToDraw() with CanDraw() because it always returns a valid | 526 // We guard PrepareToDraw() with CanDraw() because it always returns a valid |
527 // frame, so can only be used when such a frame is possible. Since | 527 // frame, so can only be used when such a frame is possible. Since |
528 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on | 528 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on |
529 // CanDraw() as well. | 529 // CanDraw() as well. |
530 if (!ShouldComposite() || (for_readback && !can_do_readback)) { | 530 if (!ShouldComposite() || (for_readback && !can_do_readback)) { |
531 UpdateBackgroundAnimateTicking(); | 531 UpdateBackgroundAnimateTicking(); |
532 return false; | 532 return false; |
533 } | 533 } |
534 | 534 |
535 layer_tree_host_impl_->OverrideCurrentFrameTime(frame_begin_time); | |
danakj
2014/03/11 18:32:36
This is really late, we'll have generated a frame
| |
535 layer_tree_host_impl_->Animate( | 536 layer_tree_host_impl_->Animate( |
536 layer_tree_host_impl_->CurrentFrameTimeTicks()); | 537 layer_tree_host_impl_->CurrentFrameTimeTicks()); |
537 UpdateBackgroundAnimateTicking(); | 538 UpdateBackgroundAnimateTicking(); |
538 | 539 |
539 if (!layer_tree_host_impl_->IsContextLost()) { | 540 if (!layer_tree_host_impl_->IsContextLost()) { |
540 layer_tree_host_impl_->PrepareToDraw(frame, device_viewport_damage_rect); | 541 layer_tree_host_impl_->PrepareToDraw(frame, device_viewport_damage_rect); |
541 layer_tree_host_impl_->DrawLayers(frame, frame_begin_time); | 542 layer_tree_host_impl_->DrawLayers(frame, frame_begin_time); |
542 layer_tree_host_impl_->DidDrawAllLayers(*frame); | 543 layer_tree_host_impl_->DidDrawAllLayers(*frame); |
543 } | 544 } |
544 lost_output_surface = layer_tree_host_impl_->IsContextLost(); | 545 lost_output_surface = layer_tree_host_impl_->IsContextLost(); |
545 | 546 |
546 bool start_ready_animations = true; | 547 bool start_ready_animations = true; |
547 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); | 548 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); |
548 | |
549 layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame(); | |
550 } | 549 } |
551 | 550 |
552 if (lost_output_surface) { | 551 if (lost_output_surface) { |
553 ContextProvider* offscreen_contexts = | 552 ContextProvider* offscreen_contexts = |
554 layer_tree_host_impl_->offscreen_context_provider(); | 553 layer_tree_host_impl_->offscreen_context_provider(); |
555 if (offscreen_contexts) | 554 if (offscreen_contexts) |
556 offscreen_contexts->VerifyContexts(); | 555 offscreen_contexts->VerifyContexts(); |
557 layer_tree_host_->DidLoseOutputSurface(); | 556 layer_tree_host_->DidLoseOutputSurface(); |
558 return false; | 557 return false; |
559 } | 558 } |
560 | 559 |
561 return true; | 560 return true; |
562 } | 561 } |
563 | 562 |
564 void SingleThreadProxy::DidSwapFrame() { | 563 void SingleThreadProxy::DidSwapFrame() { |
565 if (next_frame_is_newly_committed_frame_) { | 564 if (next_frame_is_newly_committed_frame_) { |
566 next_frame_is_newly_committed_frame_ = false; | 565 next_frame_is_newly_committed_frame_ = false; |
567 layer_tree_host_->DidCommitAndDrawFrame(); | 566 layer_tree_host_->DidCommitAndDrawFrame(); |
568 } | 567 } |
569 } | 568 } |
570 | 569 |
571 bool SingleThreadProxy::CommitPendingForTesting() { return false; } | 570 bool SingleThreadProxy::CommitPendingForTesting() { return false; } |
572 | 571 |
573 } // namespace cc | 572 } // namespace cc |
OLD | NEW |