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

Side by Side Diff: cc/trees/remote_channel_impl.h

Issue 1513643010: cc:: Add remote mode to the compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
(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 #ifndef CC_TREES_REMOTE_CHANNEL_IMPL_H_
6 #define CC_TREES_REMOTE_CHANNEL_IMPL_H_
7
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "cc/base/cc_export.h"
11 #include "cc/base/completion_event.h"
12 #include "cc/raster/task_graph_runner.h"
13 #include "cc/trees/channel_impl.h"
14 #include "cc/trees/proxy_impl.h"
15 #include "cc/trees/remote_proto_channel.h"
16
17 namespace cc {
18 class LayerTreeHost;
19 class LayerTreeSettings;
20 class RemoteChannelHost;
21
22 namespace proto {
23 class CompositorMessage;
24 class CompositorMessageToImpl;
25 class CompositorMessageToMain;
26 class InitializeImpl;
27 }
28
29 class CC_EXPORT RemoteChannelImpl : public ChannelImpl {
30 public:
31 static scoped_ptr<RemoteChannelImpl> Create(
32 RemoteChannelHost* remote_channel_host,
33 TaskGraphRunner* task_graph_runner,
34 const LayerTreeSettings& settings,
35 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
36 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
37
38 ~RemoteChannelImpl() override;
39
40 void Initialize();
41
42 void HandleProto(const proto::CompositorMessageToImpl& proto);
43
44 // Should be called on impl thread only.
45 ProxyImpl* GetProxyImplForTesting() const;
46
47 protected:
48 RemoteChannelImpl(
49 RemoteChannelHost* remote_channel_host,
50 TaskGraphRunner* task_graph_runner,
51 const LayerTreeSettings& settings,
52 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
53 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
54
55 // virtual for testing.
56 virtual scoped_ptr<ProxyImpl> CreateProxyImpl(
57 ChannelImpl* channel_impl,
58 LayerTreeHost* layer_tree_host,
59 TaskRunnerProvider* task_runner_provider,
60 scoped_ptr<BeginFrameSource> external_begin_frame_source);
61
62 bool MainFrameWillHappenForTesting();
63
64 private:
65 struct MainThreadOnly {
66 RemoteChannelHost* remote_channel_host;
67 scoped_ptr<LayerTreeHost> layer_tree_host;
David Trainor- moved to gerrit 2015/12/11 17:13:44 Comment about the specifics/expectations of this L
Khushal 2015/12/11 22:49:37 Done.
68
69 MainThreadOnly(
70 RemoteChannelImpl* remote_channel_impl,
71 RemoteChannelHost* remote_channel_host,
72 TaskGraphRunner* task_graph_runner,
73 const LayerTreeSettings& settings,
74 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
75 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
76 ~MainThreadOnly();
77 };
78
79 struct CompositorThreadOnly {
80 scoped_ptr<ProxyImpl> proxy_impl;
81 scoped_ptr<base::WeakPtrFactory<ProxyImpl>> proxy_impl_weak_factory;
82
83 CompositorThreadOnly();
84 ~CompositorThreadOnly();
85 };
86
87 // Called on impl thread.
88 // ChannelImpl implementation
89 void DidCompleteSwapBuffers() override;
90 void SetRendererCapabilitiesMainCopy(
91 const RendererCapabilities& capabilities) override;
92 void BeginMainFrameNotExpectedSoon() override;
93 void DidCommitAndDrawFrame() override;
94 void SetAnimationEvents(scoped_ptr<AnimationEventsVector> queue) override;
95 void DidLoseOutputSurface() override;
96 void RequestNewOutputSurface() override;
97 void DidInitializeOutputSurface(
98 bool success,
99 const RendererCapabilities& capabilities) override;
100 void DidCompletePageScaleAnimation() override;
101 void PostFrameTimingEventsOnMain(
102 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
103 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events)
104 override;
105 void BeginMainFrame(
106 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) override;
107
108 // Called on impl thread.
David Trainor- moved to gerrit 2015/12/11 17:13:44 Do you need this if you have it above? I'm fine w
Khushal 2015/12/11 22:49:37 I wasn't sure if having the comment only above the
109 void InitializeImplOnImpl(CompletionEvent* completion,
110 LayerTreeHost* layer_tree_host);
111 void ShutdownImplOnImpl(CompletionEvent* completion);
112
113 // Called on main thread.
114 void MainThreadHasStoppedFlinging();
115
116 MainThreadOnly& main();
117 CompositorThreadOnly& impl();
118 const CompositorThreadOnly& impl() const;
119
120 base::SingleThreadTaskRunner* MainThreadTaskRunner() const;
121 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const;
122
123 // use accessors instead of these variables directly
124 MainThreadOnly main_thread_vars_unsafe_;
125 CompositorThreadOnly compositor_thread_vars_unsafe_;
126
127 TaskRunnerProvider* task_runner_provider_;
128
129 base::WeakPtr<ProxyImpl> proxy_impl_weak_ptr_;
130
131 DISALLOW_COPY_AND_ASSIGN(RemoteChannelImpl);
132 };
133
134 } // namespace cc
135
136 #endif // CC_TREES_REMOTE_CHANNEL_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698