OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/threaded_channel.h" | 5 #include "cc/trees/threaded_channel.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 | 10 |
11 namespace cc { | 11 namespace cc { |
12 | 12 |
13 scoped_ptr<ThreadedChannel> ThreadedChannel::Create( | 13 scoped_ptr<ThreadedChannel> ThreadedChannel::Create( |
14 ThreadProxy* thread_proxy, | 14 ThreadProxy* thread_proxy, |
15 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 15 TaskRunnerProvider* task_runner_provider) { |
16 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { | |
17 return make_scoped_ptr( | 16 return make_scoped_ptr( |
18 new ThreadedChannel(thread_proxy, main_task_runner, impl_task_runner)); | 17 new ThreadedChannel(thread_proxy, task_runner_provider)); |
19 } | 18 } |
20 | 19 |
21 ThreadedChannel::ThreadedChannel( | 20 ThreadedChannel::ThreadedChannel(ThreadProxy* thread_proxy, |
22 ThreadProxy* thread_proxy, | 21 TaskRunnerProvider* task_runner_provider) |
23 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | |
24 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) | |
25 : proxy_main_(thread_proxy), | 22 : proxy_main_(thread_proxy), |
26 proxy_impl_(thread_proxy), | 23 proxy_impl_(thread_proxy), |
27 proxy_(thread_proxy), | 24 task_runner_provider_(task_runner_provider) {} |
28 main_task_runner_(main_task_runner), | |
29 impl_task_runner_(impl_task_runner) {} | |
30 | 25 |
31 void ThreadedChannel::SetThrottleFrameProductionOnImpl(bool throttle) { | 26 void ThreadedChannel::SetThrottleFrameProductionOnImpl(bool throttle) { |
32 ImplThreadTaskRunner()->PostTask( | 27 ImplThreadTaskRunner()->PostTask( |
33 FROM_HERE, base::Bind(&ProxyImpl::SetThrottleFrameProductionOnImpl, | 28 FROM_HERE, base::Bind(&ProxyImpl::SetThrottleFrameProductionOnImpl, |
34 proxy_impl_->GetImplWeakPtr(), throttle)); | 29 proxy_impl_->GetImplWeakPtr(), throttle)); |
35 } | 30 } |
36 | 31 |
37 void ThreadedChannel::UpdateTopControlsStateOnImpl(TopControlsState constraints, | 32 void ThreadedChannel::UpdateTopControlsStateOnImpl(TopControlsState constraints, |
38 TopControlsState current, | 33 TopControlsState current, |
39 bool animate) { | 34 bool animate) { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 FROM_HERE, | 214 FROM_HERE, |
220 base::Bind(&ProxyMain::BeginMainFrame, proxy_main_->GetMainWeakPtr(), | 215 base::Bind(&ProxyMain::BeginMainFrame, proxy_main_->GetMainWeakPtr(), |
221 base::Passed(&begin_main_frame_state))); | 216 base::Passed(&begin_main_frame_state))); |
222 } | 217 } |
223 | 218 |
224 ThreadedChannel::~ThreadedChannel() { | 219 ThreadedChannel::~ThreadedChannel() { |
225 TRACE_EVENT0("cc", "ThreadChannel::~ThreadChannel"); | 220 TRACE_EVENT0("cc", "ThreadChannel::~ThreadChannel"); |
226 } | 221 } |
227 | 222 |
228 base::SingleThreadTaskRunner* ThreadedChannel::MainThreadTaskRunner() const { | 223 base::SingleThreadTaskRunner* ThreadedChannel::MainThreadTaskRunner() const { |
229 return main_task_runner_.get(); | 224 return task_runner_provider_->MainThreadTaskRunner(); |
230 } | 225 } |
231 | 226 |
232 base::SingleThreadTaskRunner* ThreadedChannel::ImplThreadTaskRunner() const { | 227 base::SingleThreadTaskRunner* ThreadedChannel::ImplThreadTaskRunner() const { |
233 return impl_task_runner_.get(); | 228 return task_runner_provider_->ImplThreadTaskRunner(); |
234 } | 229 } |
235 | 230 |
236 } // namespace cc | 231 } // namespace cc |
OLD | NEW |