Chromium Code Reviews| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 SchedulerSettings scheduler_settings( | 67 SchedulerSettings scheduler_settings( |
| 68 layer_tree_host_->settings().ToSchedulerSettings()); | 68 layer_tree_host_->settings().ToSchedulerSettings()); |
| 69 scheduler_settings.commit_to_active_tree = CommitToActiveTree(); | 69 scheduler_settings.commit_to_active_tree = CommitToActiveTree(); |
| 70 | 70 |
| 71 std::unique_ptr<CompositorTimingHistory> compositor_timing_history( | 71 std::unique_ptr<CompositorTimingHistory> compositor_timing_history( |
| 72 new CompositorTimingHistory( | 72 new CompositorTimingHistory( |
| 73 scheduler_settings.using_synchronous_renderer_compositor, | 73 scheduler_settings.using_synchronous_renderer_compositor, |
| 74 CompositorTimingHistory::BROWSER_UMA, | 74 CompositorTimingHistory::BROWSER_UMA, |
| 75 layer_tree_host_->rendering_stats_instrumentation())); | 75 layer_tree_host_->rendering_stats_instrumentation())); |
| 76 | 76 |
| 77 BeginFrameSource* frame_source = nullptr; | 77 // BFS must either be external or come from the output surface. If |
| 78 if (!layer_tree_host_->settings().use_output_surface_begin_frame_source) { | 78 // external, it must be provided. If from the output surface, it must |
| 79 frame_source = external_begin_frame_source_.get(); | 79 // not be provided. |
| 80 if (!scheduler_settings.throttle_frame_production) { | 80 // TODO(enne): make all BFS come from the output surface. |
|
danakj
2016/08/16 00:30:04
nit: Make
| |
| 81 // Unthrottled source takes precedence over external sources. | 81 DCHECK(layer_tree_host_->settings().use_external_begin_frame_source ^ |
| 82 unthrottled_begin_frame_source_.reset(new BackToBackBeginFrameSource( | 82 layer_tree_host_->settings().use_output_surface_begin_frame_source); |
| 83 base::MakeUnique<DelayBasedTimeSource>( | 83 DCHECK(!layer_tree_host_->settings().use_external_begin_frame_source || |
| 84 task_runner_provider_->MainThreadTaskRunner()))); | 84 external_begin_frame_source_.get()); |
|
danakj
2016/08/16 00:30:04
nit: no .get()
| |
| 85 frame_source = unthrottled_begin_frame_source_.get(); | 85 DCHECK( |
| 86 } | 86 !layer_tree_host_->settings().use_output_surface_begin_frame_source || |
| 87 if (!frame_source) { | 87 !external_begin_frame_source_.get()); |
|
danakj
2016/08/16 00:30:04
nit: no .get()
| |
| 88 synthetic_begin_frame_source_.reset(new DelayBasedBeginFrameSource( | |
| 89 base::MakeUnique<DelayBasedTimeSource>( | |
| 90 task_runner_provider_->MainThreadTaskRunner()))); | |
| 91 frame_source = synthetic_begin_frame_source_.get(); | |
| 92 } | |
| 93 } | |
| 94 | |
| 95 scheduler_on_impl_thread_ = | 88 scheduler_on_impl_thread_ = |
| 96 Scheduler::Create(this, scheduler_settings, layer_tree_host_->id(), | 89 Scheduler::Create(this, scheduler_settings, layer_tree_host_->id(), |
| 97 task_runner_provider_->MainThreadTaskRunner(), | 90 task_runner_provider_->MainThreadTaskRunner(), |
| 98 frame_source, std::move(compositor_timing_history)); | 91 external_begin_frame_source_.get(), |
| 92 std::move(compositor_timing_history)); | |
| 99 } | 93 } |
| 100 | 94 |
| 101 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); | 95 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); |
| 102 } | 96 } |
| 103 | 97 |
| 104 SingleThreadProxy::~SingleThreadProxy() { | 98 SingleThreadProxy::~SingleThreadProxy() { |
| 105 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); | 99 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); |
| 106 DCHECK(task_runner_provider_->IsMainThread()); | 100 DCHECK(task_runner_provider_->IsMainThread()); |
| 107 // Make sure Stop() got called or never Started. | 101 // Make sure Stop() got called or never Started. |
| 108 DCHECK(!layer_tree_host_impl_); | 102 DCHECK(!layer_tree_host_impl_); |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 876 void SingleThreadProxy::DidFinishImplFrame() { | 870 void SingleThreadProxy::DidFinishImplFrame() { |
| 877 layer_tree_host_impl_->DidFinishImplFrame(); | 871 layer_tree_host_impl_->DidFinishImplFrame(); |
| 878 #if DCHECK_IS_ON() | 872 #if DCHECK_IS_ON() |
| 879 DCHECK(inside_impl_frame_) | 873 DCHECK(inside_impl_frame_) |
| 880 << "DidFinishImplFrame called while not inside an impl frame!"; | 874 << "DidFinishImplFrame called while not inside an impl frame!"; |
| 881 inside_impl_frame_ = false; | 875 inside_impl_frame_ = false; |
| 882 #endif | 876 #endif |
| 883 } | 877 } |
| 884 | 878 |
| 885 } // namespace cc | 879 } // namespace cc |
| OLD | NEW |