| 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 // the output surface if already in BEGIN_IMPL_FRAME_STATE_IDLE. | 409 // the output surface if already in BEGIN_IMPL_FRAME_STATE_IDLE. |
| 410 layer_tree_host_->DidLoseCompositorFrameSink(); | 410 layer_tree_host_->DidLoseCompositorFrameSink(); |
| 411 } | 411 } |
| 412 single_thread_client_->DidLoseCompositorFrameSink(); | 412 single_thread_client_->DidLoseCompositorFrameSink(); |
| 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 (!synthetic_begin_frame_source_) { |
| 420 scheduler_on_impl_thread_->SetBeginFrameSource(source); | 420 synthetic_begin_frame_source_.reset( |
| 421 new DelayBasedBeginFrameSource(base::MakeUnique<DelayBasedTimeSource>( |
| 422 task_runner_provider_->MainThreadTaskRunner()))); |
| 423 } |
| 424 if (scheduler_on_impl_thread_) { |
| 425 scheduler_on_impl_thread_->SetBeginFrameSource( |
| 426 synthetic_begin_frame_source_.get()); |
| 427 } |
| 421 } | 428 } |
| 422 | 429 |
| 423 void SingleThreadProxy::DidReceiveCompositorFrameAckOnImplThread() { | 430 void SingleThreadProxy::DidReceiveCompositorFrameAckOnImplThread() { |
| 424 TRACE_EVENT0("cc,benchmark", | 431 TRACE_EVENT0("cc,benchmark", |
| 425 "SingleThreadProxy::DidReceiveCompositorFrameAckOnImplThread"); | 432 "SingleThreadProxy::DidReceiveCompositorFrameAckOnImplThread"); |
| 426 if (scheduler_on_impl_thread_) | 433 if (scheduler_on_impl_thread_) |
| 427 scheduler_on_impl_thread_->DidReceiveCompositorFrameAck(); | 434 scheduler_on_impl_thread_->DidReceiveCompositorFrameAck(); |
| 428 layer_tree_host_->DidReceiveCompositorFrameAck(); | 435 layer_tree_host_->DidReceiveCompositorFrameAck(); |
| 429 } | 436 } |
| 430 | 437 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 void SingleThreadProxy::DidFinishImplFrame() { | 751 void SingleThreadProxy::DidFinishImplFrame() { |
| 745 layer_tree_host_impl_->DidFinishImplFrame(); | 752 layer_tree_host_impl_->DidFinishImplFrame(); |
| 746 #if DCHECK_IS_ON() | 753 #if DCHECK_IS_ON() |
| 747 DCHECK(inside_impl_frame_) | 754 DCHECK(inside_impl_frame_) |
| 748 << "DidFinishImplFrame called while not inside an impl frame!"; | 755 << "DidFinishImplFrame called while not inside an impl frame!"; |
| 749 inside_impl_frame_ = false; | 756 inside_impl_frame_ = false; |
| 750 #endif | 757 #endif |
| 751 } | 758 } |
| 752 | 759 |
| 753 } // namespace cc | 760 } // namespace cc |
| OLD | NEW |