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

Unified Diff: cc/trees/threaded_channel.h

Issue 1357373002: Add basic framework for splitting thread proxy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor clean-up. 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
Index: cc/trees/threaded_channel.h
diff --git a/cc/trees/threaded_channel.h b/cc/trees/threaded_channel.h
new file mode 100644
index 0000000000000000000000000000000000000000..70238f3ded5e473828b30e22863d87f437ab3a25
--- /dev/null
+++ b/cc/trees/threaded_channel.h
@@ -0,0 +1,106 @@
+// 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.
+
+#ifndef CC_TREES_THREADED_CHANNEL_H_
+#define CC_TREES_THREADED_CHANNEL_H_
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "cc/base/cc_export.h"
+#include "cc/trees/channel_impl.h"
+#include "cc/trees/channel_main.h"
+#include "cc/trees/proxy_impl.h"
+#include "cc/trees/proxy_main.h"
+#include "cc/trees/thread_proxy.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+}
+
+namespace cc {
+class ChannelImpl;
+class ChannelMain;
+class ProxyImpl;
+class ProxyMain;
+class ThreadProxy;
+
+// An implementation of ChannelMain and ChannelImpl that sends commands between
+// ProxyMain and ProxyImpl across thread boundaries.
+//
+// LayerTreeHost creates ThreadedChannel and passes the ownership to ProxyMain.
+// The object life cycle and communication across threads is as follows:
+//
+//
+// Main Thread | Impl Thread
+// LayerTreeHost->InitializeProxy |
+// | |
+// ProxyMain->Start() |
+// | ThreadedChannel
+// ---------------------------------------------------------------------------
+// ChannelMain::InitializeImpl ---PostTask---> ThreadedChannel::
+// InitializeImplOnImplThread
+// |
+// ProxyImpl::Create
+// |
+// ProxyImpl->Initialize()
+// .
+// .
+// ProxyImpl::ScheduledActionBegin
+// OutputSurfaceCreation
+// |
+// ChannelImpl::RequestNewOutputSurface
+// ----------------------------------------------------------------------------
+// |
+// ProxyMain->RequestNewOutputSurface()<----PostTask--------
+// .
+// .
+// ProxyMain->LayerTreeHostClosed
+// |
+// ---------------------------------------------------------------------------
+// ChannelMain::SetLayerTreeClosedOnImpl---PostTask---> ProxyImpl->
+// SetLayerTreeClosed
+// ----------------------------------------------------------------------------
+
+class CC_EXPORT ThreadedChannel : public ChannelMain, public ChannelImpl {
+ public:
+ static scoped_ptr<ThreadedChannel> Create(
+ // TODO(khushalsagar): Make this ProxyMain* and write the initialization
+ // sequence. Currently ThreadProxy implements both so we pass the pointer
+ // and set ProxyImpl.
+ ThreadProxy* thread_proxy,
+ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
+
+ ~ThreadedChannel() override;
+
+ // ChannelMain Implementation
+ void SetThrottleFrameProductionOnImpl(bool throttle) override;
+ void SetLayerTreeHostClientReadyOnImpl() override;
+
+ // ChannelImpl Implementation
+ void DidCompleteSwapBuffers() override;
+
+ protected:
+ ThreadedChannel(ThreadProxy* thread_proxy,
+ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
+
+ private:
+ base::SingleThreadTaskRunner* MainThreadTaskRunner() const;
+ base::SingleThreadTaskRunner* ImplThreadTaskRunner() const;
+
+ ProxyMain* proxy_main_;
+
+ ProxyImpl* proxy_impl_;
+
+ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
+
+ scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadedChannel);
+};
+
+} // namespace cc
+
+#endif // CC_TREES_THREADED_CHANNEL_H_

Powered by Google App Engine
This is Rietveld 408576698