OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/trees/threaded_channel.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/trace_event/trace_event.h" |
| 10 |
| 11 namespace cc { |
| 12 |
| 13 scoped_ptr<ThreadedChannel> ThreadedChannel::Create( |
| 14 ThreadProxy* thread_proxy, |
| 15 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 16 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { |
| 17 return make_scoped_ptr( |
| 18 new ThreadedChannel(thread_proxy, main_task_runner, impl_task_runner)); |
| 19 } |
| 20 |
| 21 ThreadedChannel::ThreadedChannel( |
| 22 ThreadProxy* thread_proxy, |
| 23 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 24 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) |
| 25 : proxy_main_(thread_proxy), |
| 26 proxy_impl_(thread_proxy), |
| 27 main_task_runner_(main_task_runner), |
| 28 impl_task_runner_(impl_task_runner) {} |
| 29 |
| 30 void ThreadedChannel::SetThrottleFrameProductionOnImpl(bool throttle) { |
| 31 ImplThreadTaskRunner()->PostTask( |
| 32 FROM_HERE, base::Bind(&ProxyImpl::SetThrottleFrameProductionOnImpl, |
| 33 proxy_impl_->GetImplWeakPtr(), throttle)); |
| 34 } |
| 35 |
| 36 void ThreadedChannel::SetLayerTreeHostClientReadyOnImpl() { |
| 37 ImplThreadTaskRunner()->PostTask( |
| 38 FROM_HERE, base::Bind(&ProxyImpl::SetLayerTreeHostClientReadyOnImpl, |
| 39 proxy_impl_->GetImplWeakPtr())); |
| 40 } |
| 41 |
| 42 void ThreadedChannel::DidCompleteSwapBuffers() { |
| 43 MainThreadTaskRunner()->PostTask( |
| 44 FROM_HERE, base::Bind(&ProxyMain::DidCompleteSwapBuffers, |
| 45 proxy_main_->GetMainWeakPtr())); |
| 46 } |
| 47 |
| 48 ThreadedChannel::~ThreadedChannel() { |
| 49 TRACE_EVENT0("cc", "ThreadChannel::~ThreadChannel"); |
| 50 } |
| 51 |
| 52 base::SingleThreadTaskRunner* ThreadedChannel::MainThreadTaskRunner() const { |
| 53 return main_task_runner_.get(); |
| 54 } |
| 55 |
| 56 base::SingleThreadTaskRunner* ThreadedChannel::ImplThreadTaskRunner() const { |
| 57 return impl_task_runner_.get(); |
| 58 } |
| 59 |
| 60 } // namespace cc |
OLD | NEW |