Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Unified Diff: cc/trees/threaded_channel.cc

Issue 1357373002: Add basic framework for splitting thread proxy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« cc/cc.gyp ('K') | « cc/trees/threaded_channel.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/threaded_channel.cc
diff --git a/cc/trees/threaded_channel.cc b/cc/trees/threaded_channel.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3bc44c93efad6231bfd7c86ca208422562680a46
--- /dev/null
+++ b/cc/trees/threaded_channel.cc
@@ -0,0 +1,60 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/trees/threaded_channel.h"
+
+#include "base/bind.h"
+#include "base/single_thread_task_runner.h"
+#include "base/trace_event/trace_event.h"
+
+namespace cc {
+
+scoped_ptr<ThreadedChannel> ThreadedChannel::Create(
+ ThreadProxy* thread_proxy,
+ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
+ return make_scoped_ptr(
+ new ThreadedChannel(thread_proxy, main_task_runner, impl_task_runner));
+}
+
+ThreadedChannel::ThreadedChannel(
+ ThreadProxy* thread_proxy,
+ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner)
+ : proxy_main_(thread_proxy),
+ proxy_impl_(thread_proxy),
+ main_task_runner_(main_task_runner),
+ impl_task_runner_(impl_task_runner) {}
+
+void ThreadedChannel::SetThrottleFrameProductionOnImpl(bool throttle) {
+ ImplThreadTaskRunner()->PostTask(
+ FROM_HERE, base::Bind(&ProxyImpl::SetThrottleFrameProductionOnImpl,
+ proxy_impl_->GetImplWeakPtr(), throttle));
+}
+
+void ThreadedChannel::SetLayerTreeHostClientReadyOnImpl() {
+ ImplThreadTaskRunner()->PostTask(
+ FROM_HERE, base::Bind(&ProxyImpl::SetLayerTreeHostClientReadyOnImpl,
+ proxy_impl_->GetImplWeakPtr()));
+}
+
+void ThreadedChannel::DidCompleteSwapBuffers() {
+ MainThreadTaskRunner()->PostTask(
+ FROM_HERE, base::Bind(&ProxyMain::DidCompleteSwapBuffers,
+ proxy_main_->GetMainWeakPtr()));
+}
+
+ThreadedChannel::~ThreadedChannel() {
+ TRACE_EVENT0("cc", "ThreadChannel::~ThreadChannel");
+}
+
+base::SingleThreadTaskRunner* ThreadedChannel::MainThreadTaskRunner() const {
+ return main_task_runner_.get();
+}
+
+base::SingleThreadTaskRunner* ThreadedChannel::ImplThreadTaskRunner() const {
+ return impl_task_runner_.get();
+}
+
+} // namespace cc
« cc/cc.gyp ('K') | « cc/trees/threaded_channel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698