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

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

Issue 2340143002: cc: Rename LayerTreeHost to LayerTreeHostInProcess. (Closed)
Patch Set: tests + comment updates Created 4 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 unified diff | Download patch
OLDNEW
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 #ifndef CC_TREES_THREADED_CHANNEL_H_ 5 #ifndef CC_TREES_THREADED_CHANNEL_H_
6 #define CC_TREES_THREADED_CHANNEL_H_ 6 #define CC_TREES_THREADED_CHANNEL_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "cc/base/cc_export.h" 13 #include "cc/base/cc_export.h"
14 #include "cc/trees/channel_impl.h" 14 #include "cc/trees/channel_impl.h"
15 #include "cc/trees/channel_main.h" 15 #include "cc/trees/channel_main.h"
16 #include "cc/trees/proxy_common.h" 16 #include "cc/trees/proxy_common.h"
17 #include "cc/trees/proxy_impl.h" 17 #include "cc/trees/proxy_impl.h"
18 #include "cc/trees/proxy_main.h" 18 #include "cc/trees/proxy_main.h"
19 19
20 namespace base { 20 namespace base {
21 class SingleThreadTaskRunner; 21 class SingleThreadTaskRunner;
22 } 22 }
23 23
24 namespace cc { 24 namespace cc {
25 class ChannelImpl; 25 class ChannelImpl;
26 class ChannelMain; 26 class ChannelMain;
27 class LayerTreeHost; 27 class LayerTreeHostInProcess;
28 class ProxyImpl; 28 class ProxyImpl;
29 class ProxyMain; 29 class ProxyMain;
30 30
31 // An implementation of ChannelMain and ChannelImpl that sends commands between 31 // An implementation of ChannelMain and ChannelImpl that sends commands between
32 // ProxyMain and ProxyImpl across thread boundaries. 32 // ProxyMain and ProxyImpl across thread boundaries.
33 // 33 //
34 // LayerTreeHost creates ThreadedChannel and passes the ownership to ProxyMain. 34 // LayerTreeHostInProcess creates ThreadedChannel and passes the ownership to
35 // The object life cycle and communication across threads is as follows: 35 // ProxyMain. The object life cycle and communication across threads is as
36 // 36 // follows:
37 // 37 //
38 // Main Thread | Impl Thread 38 // Main Thread | Impl Thread
39 // LayerTreeHost->InitializeProxy | 39 // LayerTreeHostInProcess->InitializeProxy |
40 // | | 40 // | |
41 // ProxyMain->Start() | 41 // ProxyMain->Start() |
42 // | ThreadedChannel 42 // | ThreadedChannel
43 // --------------------------------------------------------------------------- 43 // ---------------------------------------------------------------------------
44 // ChannelMain::SynchronouslyInitializeImpl ---PostTask---> ThreadedChannel:: 44 // ChannelMain::SynchronouslyInitializeImpl ---PostTask---> ThreadedChannel::
45 // InitializeImplOnImpl 45 // InitializeImplOnImpl
46 // | 46 // |
47 // ProxyImpl::Create 47 // ProxyImpl::Create
48 // | 48 // |
49 // ProxyImpl->Initialize() 49 // ProxyImpl->Initialize()
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 std::vector<std::unique_ptr<SwapPromise>> swap_promises) override; 100 std::vector<std::unique_ptr<SwapPromise>> swap_promises) override;
101 void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) override; 101 void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) override;
102 void SetVisibleOnImpl(bool visible) override; 102 void SetVisibleOnImpl(bool visible) override;
103 103
104 // Blocking calls to ProxyImpl 104 // Blocking calls to ProxyImpl
105 void ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) override; 105 void ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) override;
106 void MainFrameWillHappenOnImplForTesting( 106 void MainFrameWillHappenOnImplForTesting(
107 CompletionEvent* completion, 107 CompletionEvent* completion,
108 bool* main_frame_will_happen) override; 108 bool* main_frame_will_happen) override;
109 void NotifyReadyToCommitOnImpl(CompletionEvent* completion, 109 void NotifyReadyToCommitOnImpl(CompletionEvent* completion,
110 LayerTreeHost* layer_tree_host, 110 LayerTreeHostInProcess* layer_tree_host,
111 base::TimeTicks main_thread_start_time, 111 base::TimeTicks main_thread_start_time,
112 bool hold_commit_for_activation) override; 112 bool hold_commit_for_activation) override;
113 void SynchronouslyInitializeImpl( 113 void SynchronouslyInitializeImpl(
114 LayerTreeHost* layer_tree_host, 114 LayerTreeHostInProcess* layer_tree_host,
115 std::unique_ptr<BeginFrameSource> external_begin_frame_source) override; 115 std::unique_ptr<BeginFrameSource> external_begin_frame_source) override;
116 void SynchronouslyCloseImpl() override; 116 void SynchronouslyCloseImpl() override;
117 117
118 // ChannelImpl Implementation 118 // ChannelImpl Implementation
119 void DidCompleteSwapBuffers() override; 119 void DidCompleteSwapBuffers() override;
120 void BeginMainFrameNotExpectedSoon() override; 120 void BeginMainFrameNotExpectedSoon() override;
121 void DidCommitAndDrawFrame() override; 121 void DidCommitAndDrawFrame() override;
122 void SetAnimationEvents(std::unique_ptr<AnimationEvents> events) override; 122 void SetAnimationEvents(std::unique_ptr<AnimationEvents> events) override;
123 void DidLoseOutputSurface() override; 123 void DidLoseOutputSurface() override;
124 void RequestNewOutputSurface() override; 124 void RequestNewOutputSurface() override;
125 void DidInitializeOutputSurface(bool success) override; 125 void DidInitializeOutputSurface(bool success) override;
126 void DidCompletePageScaleAnimation() override; 126 void DidCompletePageScaleAnimation() override;
127 void BeginMainFrame(std::unique_ptr<BeginMainFrameAndCommitState> 127 void BeginMainFrame(std::unique_ptr<BeginMainFrameAndCommitState>
128 begin_main_frame_state) override; 128 begin_main_frame_state) override;
129 129
130 protected: 130 protected:
131 ThreadedChannel(ProxyMain* proxy_main, 131 ThreadedChannel(ProxyMain* proxy_main,
132 TaskRunnerProvider* task_runner_provider); 132 TaskRunnerProvider* task_runner_provider);
133 133
134 // Virtual for testing. 134 // Virtual for testing.
135 virtual std::unique_ptr<ProxyImpl> CreateProxyImpl( 135 virtual std::unique_ptr<ProxyImpl> CreateProxyImpl(
136 ChannelImpl* channel_impl, 136 ChannelImpl* channel_impl,
137 LayerTreeHost* layer_tree_host, 137 LayerTreeHostInProcess* layer_tree_host,
138 TaskRunnerProvider* task_runner_provider, 138 TaskRunnerProvider* task_runner_provider,
139 std::unique_ptr<BeginFrameSource> external_begin_frame_source); 139 std::unique_ptr<BeginFrameSource> external_begin_frame_source);
140 140
141 private: 141 private:
142 // The members of this struct should be accessed on the main thread only. 142 // The members of this struct should be accessed on the main thread only.
143 struct MainThreadOnly { 143 struct MainThreadOnly {
144 explicit MainThreadOnly(ProxyMain* proxy_main); 144 explicit MainThreadOnly(ProxyMain* proxy_main);
145 ~MainThreadOnly(); 145 ~MainThreadOnly();
146 146
147 base::WeakPtrFactory<ProxyMain> proxy_main_weak_factory; 147 base::WeakPtrFactory<ProxyMain> proxy_main_weak_factory;
(...skipping 19 matching lines...) Expand all
167 // thread. Since the weak pointer is invalidated after the impl-thread tear 167 // thread. Since the weak pointer is invalidated after the impl-thread tear
168 // down in SynchronouslyCloseImpl, this ensures that any tasks posted to 168 // down in SynchronouslyCloseImpl, this ensures that any tasks posted to
169 // ProxyMain from the impl thread are abandoned after the impl side has been 169 // ProxyMain from the impl thread are abandoned after the impl side has been
170 // destroyed. 170 // destroyed.
171 base::WeakPtr<ProxyMain> proxy_main_weak_ptr; 171 base::WeakPtr<ProxyMain> proxy_main_weak_ptr;
172 }; 172 };
173 173
174 // Called on impl thread. 174 // Called on impl thread.
175 void InitializeImplOnImpl( 175 void InitializeImplOnImpl(
176 CompletionEvent* completion, 176 CompletionEvent* completion,
177 LayerTreeHost* layer_tree_host, 177 LayerTreeHostInProcess* layer_tree_host,
178 std::unique_ptr<BeginFrameSource> external_begin_frame_source); 178 std::unique_ptr<BeginFrameSource> external_begin_frame_source);
179 void CloseImplOnImpl(CompletionEvent* completion); 179 void CloseImplOnImpl(CompletionEvent* completion);
180 180
181 bool IsInitialized() const; 181 bool IsInitialized() const;
182 182
183 base::SingleThreadTaskRunner* MainThreadTaskRunner() const; 183 base::SingleThreadTaskRunner* MainThreadTaskRunner() const;
184 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const; 184 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const;
185 bool IsMainThread() const; 185 bool IsMainThread() const;
186 bool IsImplThread() const; 186 bool IsImplThread() const;
187 187
(...skipping 14 matching lines...) Expand all
202 // Used on the main thread to safely queue calls to ProxyImpl to be run on the 202 // Used on the main thread to safely queue calls to ProxyImpl to be run on the
203 // impl thread. 203 // impl thread.
204 base::WeakPtr<ProxyImpl> proxy_impl_weak_ptr_; 204 base::WeakPtr<ProxyImpl> proxy_impl_weak_ptr_;
205 205
206 DISALLOW_COPY_AND_ASSIGN(ThreadedChannel); 206 DISALLOW_COPY_AND_ASSIGN(ThreadedChannel);
207 }; 207 };
208 208
209 } // namespace cc 209 } // namespace cc
210 210
211 #endif // CC_TREES_THREADED_CHANNEL_H_ 211 #endif // CC_TREES_THREADED_CHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698