OLD | NEW |
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" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // Blocking calls to ProxyImpl | 105 // Blocking calls to ProxyImpl |
106 void ReleaseCompositorFrameSinkOnImpl(CompletionEvent* completion) override; | 106 void ReleaseCompositorFrameSinkOnImpl(CompletionEvent* completion) override; |
107 void MainFrameWillHappenOnImplForTesting( | 107 void MainFrameWillHappenOnImplForTesting( |
108 CompletionEvent* completion, | 108 CompletionEvent* completion, |
109 bool* main_frame_will_happen) override; | 109 bool* main_frame_will_happen) override; |
110 void NotifyReadyToCommitOnImpl(CompletionEvent* completion, | 110 void NotifyReadyToCommitOnImpl(CompletionEvent* completion, |
111 LayerTreeHostInProcess* layer_tree_host, | 111 LayerTreeHostInProcess* layer_tree_host, |
112 base::TimeTicks main_thread_start_time, | 112 base::TimeTicks main_thread_start_time, |
113 bool hold_commit_for_activation) override; | 113 bool hold_commit_for_activation) override; |
114 void SynchronouslyInitializeImpl( | 114 void SynchronouslyInitializeImpl( |
115 LayerTreeHostInProcess* layer_tree_host, | 115 LayerTreeHostInProcess* layer_tree_host) override; |
116 std::unique_ptr<BeginFrameSource> external_begin_frame_source) override; | |
117 void SynchronouslyCloseImpl() override; | 116 void SynchronouslyCloseImpl() override; |
118 | 117 |
119 // ChannelImpl Implementation | 118 // ChannelImpl Implementation |
120 void DidCompleteSwapBuffers() override; | 119 void DidCompleteSwapBuffers() override; |
121 void BeginMainFrameNotExpectedSoon() override; | 120 void BeginMainFrameNotExpectedSoon() override; |
122 void DidCommitAndDrawFrame() override; | 121 void DidCommitAndDrawFrame() override; |
123 void SetAnimationEvents(std::unique_ptr<AnimationEvents> events) override; | 122 void SetAnimationEvents(std::unique_ptr<AnimationEvents> events) override; |
124 void DidLoseCompositorFrameSink() override; | 123 void DidLoseCompositorFrameSink() override; |
125 void RequestNewCompositorFrameSink() override; | 124 void RequestNewCompositorFrameSink() override; |
126 void DidInitializeCompositorFrameSink(bool success) override; | 125 void DidInitializeCompositorFrameSink(bool success) override; |
127 void DidCompletePageScaleAnimation() override; | 126 void DidCompletePageScaleAnimation() override; |
128 void BeginMainFrame(std::unique_ptr<BeginMainFrameAndCommitState> | 127 void BeginMainFrame(std::unique_ptr<BeginMainFrameAndCommitState> |
129 begin_main_frame_state) override; | 128 begin_main_frame_state) override; |
130 | 129 |
131 protected: | 130 protected: |
132 ThreadedChannel(ProxyMain* proxy_main, | 131 ThreadedChannel(ProxyMain* proxy_main, |
133 TaskRunnerProvider* task_runner_provider); | 132 TaskRunnerProvider* task_runner_provider); |
134 | 133 |
135 // Virtual for testing. | 134 // Virtual for testing. |
136 virtual std::unique_ptr<ProxyImpl> CreateProxyImpl( | 135 virtual std::unique_ptr<ProxyImpl> CreateProxyImpl( |
137 ChannelImpl* channel_impl, | 136 ChannelImpl* channel_impl, |
138 LayerTreeHostInProcess* layer_tree_host, | 137 LayerTreeHostInProcess* layer_tree_host, |
139 TaskRunnerProvider* task_runner_provider, | 138 TaskRunnerProvider* task_runner_provider); |
140 std::unique_ptr<BeginFrameSource> external_begin_frame_source); | |
141 | 139 |
142 private: | 140 private: |
143 // The members of this struct should be accessed on the main thread only. | 141 // The members of this struct should be accessed on the main thread only. |
144 struct MainThreadOnly { | 142 struct MainThreadOnly { |
145 explicit MainThreadOnly(ProxyMain* proxy_main); | 143 explicit MainThreadOnly(ProxyMain* proxy_main); |
146 ~MainThreadOnly(); | 144 ~MainThreadOnly(); |
147 | 145 |
148 base::WeakPtrFactory<ProxyMain> proxy_main_weak_factory; | 146 base::WeakPtrFactory<ProxyMain> proxy_main_weak_factory; |
149 bool initialized; | 147 bool initialized; |
150 }; | 148 }; |
(...skipping 15 matching lines...) Expand all Loading... |
166 | 164 |
167 // Used on the impl thread to queue calls to ProxyMain to be run on the main | 165 // Used on the impl thread to queue calls to ProxyMain to be run on the main |
168 // thread. Since the weak pointer is invalidated after the impl-thread tear | 166 // thread. Since the weak pointer is invalidated after the impl-thread tear |
169 // down in SynchronouslyCloseImpl, this ensures that any tasks posted to | 167 // down in SynchronouslyCloseImpl, this ensures that any tasks posted to |
170 // ProxyMain from the impl thread are abandoned after the impl side has been | 168 // ProxyMain from the impl thread are abandoned after the impl side has been |
171 // destroyed. | 169 // destroyed. |
172 base::WeakPtr<ProxyMain> proxy_main_weak_ptr; | 170 base::WeakPtr<ProxyMain> proxy_main_weak_ptr; |
173 }; | 171 }; |
174 | 172 |
175 // Called on impl thread. | 173 // Called on impl thread. |
176 void InitializeImplOnImpl( | 174 void InitializeImplOnImpl(CompletionEvent* completion, |
177 CompletionEvent* completion, | 175 LayerTreeHostInProcess* layer_tree_host); |
178 LayerTreeHostInProcess* layer_tree_host, | |
179 std::unique_ptr<BeginFrameSource> external_begin_frame_source); | |
180 void CloseImplOnImpl(CompletionEvent* completion); | 176 void CloseImplOnImpl(CompletionEvent* completion); |
181 | 177 |
182 bool IsInitialized() const; | 178 bool IsInitialized() const; |
183 | 179 |
184 base::SingleThreadTaskRunner* MainThreadTaskRunner() const; | 180 base::SingleThreadTaskRunner* MainThreadTaskRunner() const; |
185 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const; | 181 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const; |
186 bool IsMainThread() const; | 182 bool IsMainThread() const; |
187 bool IsImplThread() const; | 183 bool IsImplThread() const; |
188 | 184 |
189 TaskRunnerProvider* task_runner_provider_; | 185 TaskRunnerProvider* task_runner_provider_; |
(...skipping 13 matching lines...) Expand all Loading... |
203 // Used on the main thread to safely queue calls to ProxyImpl to be run on the | 199 // Used on the main thread to safely queue calls to ProxyImpl to be run on the |
204 // impl thread. | 200 // impl thread. |
205 base::WeakPtr<ProxyImpl> proxy_impl_weak_ptr_; | 201 base::WeakPtr<ProxyImpl> proxy_impl_weak_ptr_; |
206 | 202 |
207 DISALLOW_COPY_AND_ASSIGN(ThreadedChannel); | 203 DISALLOW_COPY_AND_ASSIGN(ThreadedChannel); |
208 }; | 204 }; |
209 | 205 |
210 } // namespace cc | 206 } // namespace cc |
211 | 207 |
212 #endif // CC_TREES_THREADED_CHANNEL_H_ | 208 #endif // CC_TREES_THREADED_CHANNEL_H_ |
OLD | NEW |