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/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
413 if (scheduler_on_impl_thread_) | 413 if (scheduler_on_impl_thread_) |
414 scheduler_on_impl_thread_->DidLoseCompositorFrameSink(); | 414 scheduler_on_impl_thread_->DidLoseCompositorFrameSink(); |
415 compositor_frame_sink_lost_ = true; | 415 compositor_frame_sink_lost_ = true; |
416 } | 416 } |
417 | 417 |
418 void SingleThreadProxy::SetBeginFrameSource(BeginFrameSource* source) { | 418 void SingleThreadProxy::SetBeginFrameSource(BeginFrameSource* source) { |
419 if (scheduler_on_impl_thread_) | 419 if (scheduler_on_impl_thread_) |
420 scheduler_on_impl_thread_->SetBeginFrameSource(source); | 420 scheduler_on_impl_thread_->SetBeginFrameSource(source); |
421 } | 421 } |
422 | 422 |
423 void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() { | 423 void SingleThreadProxy::DidReceiveCompositorFrameAckOnImplThread() { |
424 TRACE_EVENT0("cc,benchmark", | 424 TRACE_EVENT0("cc,benchmark", |
425 "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread"); | 425 "SingleThreadProxy::DidReceiveCompositorFrameAckOnImplThread"); |
426 if (scheduler_on_impl_thread_) | 426 if (scheduler_on_impl_thread_) |
427 scheduler_on_impl_thread_->DidSwapBuffersComplete(); | 427 scheduler_on_impl_thread_->DidReceiveCompositorFrameAck(); |
428 layer_tree_host_->DidCompleteSwapBuffers(); | 428 layer_tree_host_->DidReceiveCompositorFrameAck(); |
429 } | 429 } |
430 | 430 |
431 void SingleThreadProxy::OnDrawForCompositorFrameSink( | 431 void SingleThreadProxy::OnDrawForCompositorFrameSink( |
432 bool resourceless_software_draw) { | 432 bool resourceless_software_draw) { |
433 NOTREACHED() << "Implemented by ThreadProxy for synchronous compositor."; | 433 NOTREACHED() << "Implemented by ThreadProxy for synchronous compositor."; |
434 } | 434 } |
435 | 435 |
436 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { | 436 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { |
437 TRACE_EVENT0("cc,benchmark", "SingleThreadProxy::CompositeImmediately"); | 437 TRACE_EVENT0("cc,benchmark", "SingleThreadProxy::CompositeImmediately"); |
438 DCHECK(task_runner_provider_->IsMainThread()); | 438 DCHECK(task_runner_provider_->IsMainThread()); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
543 // the swap buffers will execute first. | 543 // the swap buffers will execute first. |
544 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); | 544 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); |
545 BlockingTaskRunner::CapturePostTasks blocked( | 545 BlockingTaskRunner::CapturePostTasks blocked( |
546 task_runner_provider_->blocking_main_thread_task_runner()); | 546 task_runner_provider_->blocking_main_thread_task_runner()); |
547 | 547 |
548 draw_result = layer_tree_host_impl_->PrepareToDraw(frame); | 548 draw_result = layer_tree_host_impl_->PrepareToDraw(frame); |
549 draw_frame = draw_result == DRAW_SUCCESS; | 549 draw_frame = draw_result == DRAW_SUCCESS; |
550 if (draw_frame) { | 550 if (draw_frame) { |
551 if (layer_tree_host_impl_->DrawLayers(frame)) { | 551 if (layer_tree_host_impl_->DrawLayers(frame)) { |
552 if (scheduler_on_impl_thread_) | 552 if (scheduler_on_impl_thread_) |
553 scheduler_on_impl_thread_->DidSwapBuffers(); | 553 scheduler_on_impl_thread_->DidSubmitCompositorFrame(); |
554 client_->DidPostSwapBuffers(); | 554 client_->DidPostSwapBuffers(); |
sunnyps
2016/10/11 18:32:49
Should DidPostSwapBuffers also be renamed?
danakj
2016/10/13 23:50:22
Yes, ok I kept going and renamed this and that hit
| |
555 } | 555 } |
556 } | 556 } |
557 layer_tree_host_impl_->DidDrawAllLayers(*frame); | 557 layer_tree_host_impl_->DidDrawAllLayers(*frame); |
558 | 558 |
559 bool start_ready_animations = draw_frame; | 559 bool start_ready_animations = draw_frame; |
560 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); | 560 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); |
561 } | 561 } |
562 DidCommitAndDrawFrame(); | 562 DidCommitAndDrawFrame(); |
563 | 563 |
564 return draw_result; | 564 return draw_result; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
681 DebugScopedSetImplThread impl(task_runner_provider_); | 681 DebugScopedSetImplThread impl(task_runner_provider_); |
682 DCHECK(scheduler_on_impl_thread_->CommitPending()); | 682 DCHECK(scheduler_on_impl_thread_->CommitPending()); |
683 DCHECK(!layer_tree_host_impl_->pending_tree()); | 683 DCHECK(!layer_tree_host_impl_->pending_tree()); |
684 | 684 |
685 std::vector<std::unique_ptr<SwapPromise>> empty_swap_promises; | 685 std::vector<std::unique_ptr<SwapPromise>> empty_swap_promises; |
686 layer_tree_host_impl_->BeginMainFrameAborted(reason, | 686 layer_tree_host_impl_->BeginMainFrameAborted(reason, |
687 std::move(empty_swap_promises)); | 687 std::move(empty_swap_promises)); |
688 scheduler_on_impl_thread_->BeginMainFrameAborted(reason); | 688 scheduler_on_impl_thread_->BeginMainFrameAborted(reason); |
689 } | 689 } |
690 | 690 |
691 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible() { | 691 DrawResult SingleThreadProxy::ScheduledActionSubmitCompositorFrameIfPossible() { |
692 DebugScopedSetImplThread impl(task_runner_provider_); | 692 DebugScopedSetImplThread impl(task_runner_provider_); |
693 LayerTreeHostImpl::FrameData frame; | 693 LayerTreeHostImpl::FrameData frame; |
694 return DoComposite(&frame); | 694 return DoComposite(&frame); |
695 } | 695 } |
696 | 696 |
697 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapForced() { | 697 DrawResult SingleThreadProxy::ScheduledActionSubmitCompositorFrameForced() { |
698 NOTREACHED(); | 698 NOTREACHED(); |
699 return INVALID_RESULT; | 699 return INVALID_RESULT; |
700 } | 700 } |
701 | 701 |
702 void SingleThreadProxy::ScheduledActionCommit() { | 702 void SingleThreadProxy::ScheduledActionCommit() { |
703 DebugScopedSetMainThread main(task_runner_provider_); | 703 DebugScopedSetMainThread main(task_runner_provider_); |
704 DoCommit(); | 704 DoCommit(); |
705 } | 705 } |
706 | 706 |
707 void SingleThreadProxy::ScheduledActionActivateSyncTree() { | 707 void SingleThreadProxy::ScheduledActionActivateSyncTree() { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
742 void SingleThreadProxy::DidFinishImplFrame() { | 742 void SingleThreadProxy::DidFinishImplFrame() { |
743 layer_tree_host_impl_->DidFinishImplFrame(); | 743 layer_tree_host_impl_->DidFinishImplFrame(); |
744 #if DCHECK_IS_ON() | 744 #if DCHECK_IS_ON() |
745 DCHECK(inside_impl_frame_) | 745 DCHECK(inside_impl_frame_) |
746 << "DidFinishImplFrame called while not inside an impl frame!"; | 746 << "DidFinishImplFrame called while not inside an impl frame!"; |
747 inside_impl_frame_ = false; | 747 inside_impl_frame_ = false; |
748 #endif | 748 #endif |
749 } | 749 } |
750 | 750 |
751 } // namespace cc | 751 } // namespace cc |
OLD | NEW |