| 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/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "cc/debug/benchmark_instrumentation.h" | 10 #include "cc/debug/benchmark_instrumentation.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 SingleThreadProxy::SingleThreadProxy( | 37 SingleThreadProxy::SingleThreadProxy( |
| 38 LayerTreeHost* layer_tree_host, | 38 LayerTreeHost* layer_tree_host, |
| 39 LayerTreeHostSingleThreadClient* client, | 39 LayerTreeHostSingleThreadClient* client, |
| 40 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 40 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 41 scoped_ptr<BeginFrameSource> external_begin_frame_source) | 41 scoped_ptr<BeginFrameSource> external_begin_frame_source) |
| 42 : Proxy(main_task_runner, NULL), | 42 : Proxy(main_task_runner, NULL), |
| 43 layer_tree_host_(layer_tree_host), | 43 layer_tree_host_(layer_tree_host), |
| 44 client_(client), | 44 client_(client), |
| 45 external_begin_frame_source_(external_begin_frame_source.Pass()), |
| 45 timing_history_(layer_tree_host->rendering_stats_instrumentation()), | 46 timing_history_(layer_tree_host->rendering_stats_instrumentation()), |
| 46 next_frame_is_newly_committed_frame_(false), | 47 next_frame_is_newly_committed_frame_(false), |
| 47 #if DCHECK_IS_ON() | 48 #if DCHECK_IS_ON() |
| 48 inside_impl_frame_(false), | 49 inside_impl_frame_(false), |
| 49 #endif | 50 #endif |
| 50 inside_draw_(false), | 51 inside_draw_(false), |
| 51 defer_commits_(false), | 52 defer_commits_(false), |
| 52 animate_requested_(false), | 53 animate_requested_(false), |
| 53 commit_requested_(false), | 54 commit_requested_(false), |
| 54 inside_synchronous_composite_(false), | 55 inside_synchronous_composite_(false), |
| 55 output_surface_creation_requested_(false), | 56 output_surface_creation_requested_(false), |
| 56 weak_factory_(this) { | 57 weak_factory_(this) { |
| 57 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); | 58 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); |
| 58 DCHECK(Proxy::IsMainThread()); | 59 DCHECK(Proxy::IsMainThread()); |
| 59 DCHECK(layer_tree_host); | 60 DCHECK(layer_tree_host); |
| 60 | 61 |
| 61 if (layer_tree_host->settings().single_thread_proxy_scheduler && | 62 if (layer_tree_host->settings().single_thread_proxy_scheduler && |
| 62 !scheduler_on_impl_thread_) { | 63 !scheduler_on_impl_thread_) { |
| 63 SchedulerSettings scheduler_settings( | 64 SchedulerSettings scheduler_settings( |
| 64 layer_tree_host->settings().ToSchedulerSettings()); | 65 layer_tree_host->settings().ToSchedulerSettings()); |
| 65 // SingleThreadProxy should run in main thread low latency mode. | 66 // SingleThreadProxy should run in main thread low latency mode. |
| 66 scheduler_settings.main_thread_should_always_be_low_latency = true; | 67 scheduler_settings.main_thread_should_always_be_low_latency = true; |
| 67 scheduler_on_impl_thread_ = Scheduler::Create( | 68 scheduler_on_impl_thread_ = Scheduler::Create( |
| 68 this, scheduler_settings, layer_tree_host_->id(), | 69 this, scheduler_settings, layer_tree_host_->id(), |
| 69 MainThreadTaskRunner(), external_begin_frame_source.Pass()); | 70 MainThreadTaskRunner(), external_begin_frame_source_.get()); |
| 70 } | 71 } |
| 71 } | 72 } |
| 72 | 73 |
| 73 void SingleThreadProxy::Start() { | 74 void SingleThreadProxy::Start() { |
| 74 DebugScopedSetImplThread impl(this); | 75 DebugScopedSetImplThread impl(this); |
| 75 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); | 76 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); |
| 76 } | 77 } |
| 77 | 78 |
| 78 SingleThreadProxy::~SingleThreadProxy() { | 79 SingleThreadProxy::~SingleThreadProxy() { |
| 79 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); | 80 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 << "DidFinishImplFrame called while not inside an impl frame!"; | 1002 << "DidFinishImplFrame called while not inside an impl frame!"; |
| 1002 inside_impl_frame_ = false; | 1003 inside_impl_frame_ = false; |
| 1003 #endif | 1004 #endif |
| 1004 } | 1005 } |
| 1005 | 1006 |
| 1006 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { | 1007 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
| 1007 layer_tree_host_->SendBeginFramesToChildren(args); | 1008 layer_tree_host_->SendBeginFramesToChildren(args); |
| 1008 } | 1009 } |
| 1009 | 1010 |
| 1010 } // namespace cc | 1011 } // namespace cc |
| OLD | NEW |