| 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 #include "cc/trees/threaded_channel.h" | 5 #include "cc/trees/threaded_channel.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "cc/trees/layer_tree_host.h" |
| 10 | 11 |
| 11 namespace cc { | 12 namespace cc { |
| 12 | 13 |
| 13 scoped_ptr<ThreadedChannel> ThreadedChannel::Create( | 14 scoped_ptr<ThreadedChannel> ThreadedChannel::Create(ProxyMain* proxy_main) { |
| 14 ThreadProxy* thread_proxy, | 15 return make_scoped_ptr(new ThreadedChannel(proxy_main)); |
| 15 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | |
| 16 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { | |
| 17 return make_scoped_ptr( | |
| 18 new ThreadedChannel(thread_proxy, main_task_runner, impl_task_runner)); | |
| 19 } | 16 } |
| 20 | 17 |
| 21 ThreadedChannel::ThreadedChannel( | 18 ThreadedChannel::ThreadedChannel(ProxyMain* proxy_main) |
| 22 ThreadProxy* thread_proxy, | 19 : proxy_main_(proxy_main) {} |
| 23 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | |
| 24 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) | |
| 25 : proxy_main_(thread_proxy), | |
| 26 proxy_impl_(thread_proxy), | |
| 27 proxy_(thread_proxy), | |
| 28 main_task_runner_(main_task_runner), | |
| 29 impl_task_runner_(impl_task_runner) {} | |
| 30 | 20 |
| 31 void ThreadedChannel::SetThrottleFrameProductionOnImpl(bool throttle) { | 21 void ThreadedChannel::SetThrottleFrameProductionOnImpl(bool throttle) { |
| 32 ImplThreadTaskRunner()->PostTask( | 22 ImplThreadTaskRunner()->PostTask( |
| 33 FROM_HERE, base::Bind(&ProxyImpl::SetThrottleFrameProductionOnImpl, | 23 FROM_HERE, base::Bind(&ProxyImpl::SetThrottleFrameProductionOnImpl, |
| 34 proxy_impl_->GetImplWeakPtr(), throttle)); | 24 proxy_impl_->GetWeakPtr(), throttle)); |
| 35 } | 25 } |
| 36 | 26 |
| 37 void ThreadedChannel::UpdateTopControlsStateOnImpl(TopControlsState constraints, | 27 void ThreadedChannel::UpdateTopControlsStateOnImpl(TopControlsState constraints, |
| 38 TopControlsState current, | 28 TopControlsState current, |
| 39 bool animate) { | 29 bool animate) { |
| 40 ImplThreadTaskRunner()->PostTask( | 30 ImplThreadTaskRunner()->PostTask( |
| 41 FROM_HERE, | 31 FROM_HERE, |
| 42 base::Bind(&ProxyImpl::UpdateTopControlsStateOnImpl, | 32 base::Bind(&ProxyImpl::UpdateTopControlsStateOnImpl, |
| 43 proxy_impl_->GetImplWeakPtr(), constraints, current, animate)); | 33 proxy_impl_->GetWeakPtr(), constraints, current, animate)); |
| 44 } | 34 } |
| 45 | 35 |
| 46 void ThreadedChannel::InitializeOutputSurfaceOnImpl( | 36 void ThreadedChannel::InitializeOutputSurfaceOnImpl( |
| 47 OutputSurface* output_surface) { | 37 OutputSurface* output_surface) { |
| 48 ImplThreadTaskRunner()->PostTask( | 38 ImplThreadTaskRunner()->PostTask( |
| 49 FROM_HERE, base::Bind(&ProxyImpl::InitializeOutputSurfaceOnImpl, | 39 FROM_HERE, base::Bind(&ProxyImpl::InitializeOutputSurfaceOnImpl, |
| 50 proxy_impl_->GetImplWeakPtr(), output_surface)); | 40 proxy_impl_->GetWeakPtr(), output_surface)); |
| 51 } | 41 } |
| 52 | 42 |
| 53 void ThreadedChannel::MainThreadHasStoppedFlingingOnImpl() { | 43 void ThreadedChannel::MainThreadHasStoppedFlingingOnImpl() { |
| 54 ImplThreadTaskRunner()->PostTask( | 44 ImplThreadTaskRunner()->PostTask( |
| 55 FROM_HERE, base::Bind(&ProxyImpl::MainThreadHasStoppedFlingingOnImpl, | 45 FROM_HERE, base::Bind(&ProxyImpl::MainThreadHasStoppedFlingingOnImpl, |
| 56 proxy_impl_->GetImplWeakPtr())); | 46 proxy_impl_->GetWeakPtr())); |
| 57 } | 47 } |
| 58 | 48 |
| 59 void ThreadedChannel::SetInputThrottledUntilCommitOnImpl(bool is_throttled) { | 49 void ThreadedChannel::SetInputThrottledUntilCommitOnImpl(bool is_throttled) { |
| 60 ImplThreadTaskRunner()->PostTask( | 50 ImplThreadTaskRunner()->PostTask( |
| 61 FROM_HERE, base::Bind(&ProxyImpl::SetInputThrottledUntilCommitOnImpl, | 51 FROM_HERE, base::Bind(&ProxyImpl::SetInputThrottledUntilCommitOnImpl, |
| 62 proxy_impl_->GetImplWeakPtr(), is_throttled)); | 52 proxy_impl_->GetWeakPtr(), is_throttled)); |
| 63 } | 53 } |
| 64 | 54 |
| 65 void ThreadedChannel::SetDeferCommitsOnImpl(bool defer_commits) { | 55 void ThreadedChannel::SetDeferCommitsOnImpl(bool defer_commits) { |
| 66 ImplThreadTaskRunner()->PostTask( | 56 ImplThreadTaskRunner()->PostTask( |
| 67 FROM_HERE, base::Bind(&ProxyImpl::SetDeferCommitsOnImpl, | 57 FROM_HERE, base::Bind(&ProxyImpl::SetDeferCommitsOnImpl, |
| 68 proxy_impl_->GetImplWeakPtr(), defer_commits)); | 58 proxy_impl_->GetWeakPtr(), defer_commits)); |
| 69 } | 59 } |
| 70 | 60 |
| 71 void ThreadedChannel::FinishAllRenderingOnImpl(CompletionEvent* completion) { | 61 void ThreadedChannel::FinishAllRenderingOnImpl(CompletionEvent* completion) { |
| 72 ImplThreadTaskRunner()->PostTask( | 62 ImplThreadTaskRunner()->PostTask( |
| 73 FROM_HERE, base::Bind(&ProxyImpl::FinishAllRenderingOnImpl, | 63 FROM_HERE, base::Bind(&ProxyImpl::FinishAllRenderingOnImpl, |
| 74 proxy_impl_->GetImplWeakPtr(), completion)); | 64 proxy_impl_->GetWeakPtr(), completion)); |
| 75 } | 65 } |
| 76 | 66 |
| 77 void ThreadedChannel::SetNeedsCommitOnImpl() { | 67 void ThreadedChannel::SetNeedsCommitOnImpl() { |
| 78 ImplThreadTaskRunner()->PostTask(FROM_HERE, | 68 ImplThreadTaskRunner()->PostTask( |
| 79 base::Bind(&ProxyImpl::SetNeedsCommitOnImpl, | 69 FROM_HERE, |
| 80 proxy_impl_->GetImplWeakPtr())); | 70 base::Bind(&ProxyImpl::SetNeedsCommitOnImpl, proxy_impl_->GetWeakPtr())); |
| 81 } | 71 } |
| 82 | 72 |
| 83 void ThreadedChannel::BeginMainFrameAbortedOnImpl(CommitEarlyOutReason reason) { | 73 void ThreadedChannel::BeginMainFrameAbortedOnImpl(CommitEarlyOutReason reason) { |
| 84 ImplThreadTaskRunner()->PostTask( | 74 ImplThreadTaskRunner()->PostTask( |
| 85 FROM_HERE, base::Bind(&ProxyImpl::BeginMainFrameAbortedOnImpl, | 75 FROM_HERE, base::Bind(&ProxyImpl::BeginMainFrameAbortedOnImpl, |
| 86 proxy_impl_->GetImplWeakPtr(), reason)); | 76 proxy_impl_->GetWeakPtr(), reason)); |
| 87 } | 77 } |
| 88 | 78 |
| 89 void ThreadedChannel::SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) { | 79 void ThreadedChannel::SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) { |
| 90 ImplThreadTaskRunner()->PostTask( | 80 ImplThreadTaskRunner()->PostTask( |
| 91 FROM_HERE, base::Bind(&ProxyImpl::SetNeedsRedrawOnImpl, | 81 FROM_HERE, base::Bind(&ProxyImpl::SetNeedsRedrawOnImpl, |
| 92 proxy_impl_->GetImplWeakPtr(), damage_rect)); | 82 proxy_impl_->GetWeakPtr(), damage_rect)); |
| 93 } | 83 } |
| 94 | 84 |
| 95 void ThreadedChannel::StartCommitOnImpl(CompletionEvent* completion, | 85 void ThreadedChannel::StartCommitOnImpl(CompletionEvent* completion, |
| 96 LayerTreeHost* layer_tree_host, | 86 LayerTreeHost* layer_tree_host, |
| 97 bool hold_commit_for_activation) { | 87 bool hold_commit_for_activation) { |
| 98 ImplThreadTaskRunner()->PostTask( | 88 ImplThreadTaskRunner()->PostTask( |
| 99 FROM_HERE, | 89 FROM_HERE, |
| 100 base::Bind(&ProxyImpl::StartCommitOnImpl, proxy_impl_->GetImplWeakPtr(), | 90 base::Bind(&ProxyImpl::StartCommitOnImpl, proxy_impl_->GetWeakPtr(), |
| 101 completion, layer_tree_host, hold_commit_for_activation)); | 91 completion, layer_tree_host, hold_commit_for_activation)); |
| 102 } | 92 } |
| 103 | 93 |
| 104 void ThreadedChannel::InitializeImplOnImpl(CompletionEvent* completion, | 94 void ThreadedChannel::InitializeImpl( |
| 105 LayerTreeHost* layer_tree_host) { | 95 CompletionEvent* completion, |
| 96 LayerTreeHost* layer_tree_host, |
| 97 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
| 98 TRACE_EVENT0("cc", "ThreadChannel::InitializeImpl"); |
| 106 ImplThreadTaskRunner()->PostTask( | 99 ImplThreadTaskRunner()->PostTask( |
| 107 FROM_HERE, | 100 FROM_HERE, base::Bind(&ThreadedChannel::InitializeImplOnImpl, |
| 108 base::Bind(&ProxyImpl::InitializeImplOnImpl, | 101 base::Unretained(this), completion, layer_tree_host, |
| 109 base::Unretained(proxy_impl_), completion, layer_tree_host)); | 102 base::Passed(&external_begin_frame_source))); |
| 110 } | 103 } |
| 111 | 104 |
| 112 void ThreadedChannel::LayerTreeHostClosedOnImpl(CompletionEvent* completion) { | 105 void ThreadedChannel::InitializeImplOnImpl( |
| 106 CompletionEvent* completion, |
| 107 LayerTreeHost* layer_tree_host, |
| 108 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
| 109 DCHECK(proxy_main_->IsImplThread()); |
| 110 proxy_impl_ = CreateProxyImpl(this, layer_tree_host, proxy_main_, |
| 111 external_begin_frame_source.Pass()); |
| 112 completion->Signal(); |
| 113 } |
| 114 |
| 115 scoped_ptr<ProxyImpl> ThreadedChannel::CreateProxyImpl( |
| 116 ChannelImpl* channel_impl, |
| 117 LayerTreeHost* layer_tree_host, |
| 118 TaskRunnerProvider* task_runner_provider, |
| 119 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
| 120 return ProxyImpl::Create(channel_impl, layer_tree_host, task_runner_provider, |
| 121 external_begin_frame_source.Pass()); |
| 122 } |
| 123 |
| 124 void ThreadedChannel::CloseImpl(CompletionEvent* completion) { |
| 125 TRACE_EVENT0("cc", "ThreadChannel::~CloseImpl"); |
| 113 ImplThreadTaskRunner()->PostTask( | 126 ImplThreadTaskRunner()->PostTask( |
| 114 FROM_HERE, base::Bind(&ProxyImpl::LayerTreeHostClosedOnImpl, | 127 FROM_HERE, base::Bind(&ThreadedChannel::CloseImplOnImpl, |
| 115 proxy_impl_->GetImplWeakPtr(), completion)); | 128 base::Unretained(this), completion)); |
| 116 proxy_impl_ = nullptr; | 129 } |
| 130 |
| 131 void ThreadedChannel::CloseImplOnImpl(CompletionEvent* completion) { |
| 132 DCHECK(proxy_main_->IsImplThread()); |
| 133 proxy_impl_->LayerTreeHostClosedOnImpl(); |
| 134 proxy_impl_.reset(); |
| 135 completion->Signal(); |
| 117 } | 136 } |
| 118 | 137 |
| 119 void ThreadedChannel::SetVisibleOnImpl(bool visible) { | 138 void ThreadedChannel::SetVisibleOnImpl(bool visible) { |
| 120 ImplThreadTaskRunner()->PostTask( | 139 ImplThreadTaskRunner()->PostTask( |
| 121 FROM_HERE, base::Bind(&ProxyImpl::SetVisibleOnImpl, | 140 FROM_HERE, base::Bind(&ProxyImpl::SetVisibleOnImpl, |
| 122 proxy_impl_->GetImplWeakPtr(), visible)); | 141 proxy_impl_->GetWeakPtr(), visible)); |
| 123 } | 142 } |
| 124 | 143 |
| 125 void ThreadedChannel::ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) { | 144 void ThreadedChannel::ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) { |
| 126 ImplThreadTaskRunner()->PostTask( | 145 ImplThreadTaskRunner()->PostTask( |
| 127 FROM_HERE, base::Bind(&ProxyImpl::ReleaseOutputSurfaceOnImpl, | 146 FROM_HERE, base::Bind(&ProxyImpl::ReleaseOutputSurfaceOnImpl, |
| 128 proxy_impl_->GetImplWeakPtr(), completion)); | 147 proxy_impl_->GetWeakPtr(), completion)); |
| 129 } | 148 } |
| 130 | 149 |
| 131 void ThreadedChannel::FinishGLOnImpl(CompletionEvent* completion) { | 150 void ThreadedChannel::FinishGLOnImpl(CompletionEvent* completion) { |
| 132 ImplThreadTaskRunner()->PostTask( | 151 ImplThreadTaskRunner()->PostTask( |
| 133 FROM_HERE, base::Bind(&ProxyImpl::FinishGLOnImpl, | 152 FROM_HERE, base::Bind(&ProxyImpl::FinishGLOnImpl, |
| 134 proxy_impl_->GetImplWeakPtr(), completion)); | 153 proxy_impl_->GetWeakPtr(), completion)); |
| 135 } | 154 } |
| 136 | 155 |
| 137 void ThreadedChannel::MainFrameWillHappenOnImplForTesting( | 156 void ThreadedChannel::MainFrameWillHappenOnImplForTesting( |
| 138 CompletionEvent* completion, | 157 CompletionEvent* completion, |
| 139 bool* main_frame_will_happen) { | 158 bool* main_frame_will_happen) { |
| 140 ImplThreadTaskRunner()->PostTask( | 159 ImplThreadTaskRunner()->PostTask( |
| 141 FROM_HERE, base::Bind(&ProxyImpl::MainFrameWillHappenOnImplForTesting, | 160 FROM_HERE, base::Bind(&ProxyImpl::MainFrameWillHappenOnImplForTesting, |
| 142 proxy_impl_->GetImplWeakPtr(), completion, | 161 proxy_impl_->GetWeakPtr(), completion, |
| 143 main_frame_will_happen)); | 162 main_frame_will_happen)); |
| 144 } | 163 } |
| 145 | 164 |
| 146 void ThreadedChannel::DidCompleteSwapBuffers() { | 165 void ThreadedChannel::DidCompleteSwapBuffers() { |
| 147 MainThreadTaskRunner()->PostTask( | 166 MainThreadTaskRunner()->PostTask( |
| 148 FROM_HERE, base::Bind(&ProxyMain::DidCompleteSwapBuffers, | 167 FROM_HERE, base::Bind(&ProxyMain::DidCompleteSwapBuffers, |
| 149 proxy_main_->GetMainWeakPtr())); | 168 proxy_main_->GetWeakPtr())); |
| 150 } | 169 } |
| 151 | 170 |
| 152 void ThreadedChannel::SetRendererCapabilitiesMainCopy( | 171 void ThreadedChannel::SetRendererCapabilitiesMainCopy( |
| 153 const RendererCapabilities& capabilities) { | 172 const RendererCapabilities& capabilities) { |
| 154 MainThreadTaskRunner()->PostTask( | 173 MainThreadTaskRunner()->PostTask( |
| 155 FROM_HERE, base::Bind(&ProxyMain::SetRendererCapabilitiesMainCopy, | 174 FROM_HERE, base::Bind(&ProxyMain::SetRendererCapabilitiesMainCopy, |
| 156 proxy_main_->GetMainWeakPtr(), capabilities)); | 175 proxy_main_->GetWeakPtr(), capabilities)); |
| 157 } | 176 } |
| 158 | 177 |
| 159 void ThreadedChannel::BeginMainFrameNotExpectedSoon() { | 178 void ThreadedChannel::BeginMainFrameNotExpectedSoon() { |
| 160 MainThreadTaskRunner()->PostTask( | 179 MainThreadTaskRunner()->PostTask( |
| 161 FROM_HERE, base::Bind(&ProxyMain::BeginMainFrameNotExpectedSoon, | 180 FROM_HERE, base::Bind(&ProxyMain::BeginMainFrameNotExpectedSoon, |
| 162 proxy_main_->GetMainWeakPtr())); | 181 proxy_main_->GetWeakPtr())); |
| 163 } | 182 } |
| 164 | 183 |
| 165 void ThreadedChannel::DidCommitAndDrawFrame() { | 184 void ThreadedChannel::DidCommitAndDrawFrame() { |
| 166 MainThreadTaskRunner()->PostTask(FROM_HERE, | 185 MainThreadTaskRunner()->PostTask( |
| 167 base::Bind(&ProxyMain::DidCommitAndDrawFrame, | 186 FROM_HERE, |
| 168 proxy_main_->GetMainWeakPtr())); | 187 base::Bind(&ProxyMain::DidCommitAndDrawFrame, proxy_main_->GetWeakPtr())); |
| 169 } | 188 } |
| 170 | 189 |
| 171 void ThreadedChannel::SetAnimationEvents( | 190 void ThreadedChannel::SetAnimationEvents( |
| 172 scoped_ptr<AnimationEventsVector> queue) { | 191 scoped_ptr<AnimationEventsVector> queue) { |
| 173 MainThreadTaskRunner()->PostTask( | 192 MainThreadTaskRunner()->PostTask( |
| 174 FROM_HERE, | 193 FROM_HERE, base::Bind(&ProxyMain::SetAnimationEvents, |
| 175 base::Bind(&ProxyMain::SetAnimationEvents, proxy_main_->GetMainWeakPtr(), | 194 proxy_main_->GetWeakPtr(), base::Passed(&queue))); |
| 176 base::Passed(&queue))); | |
| 177 } | 195 } |
| 178 | 196 |
| 179 void ThreadedChannel::DidLoseOutputSurface() { | 197 void ThreadedChannel::DidLoseOutputSurface() { |
| 180 MainThreadTaskRunner()->PostTask(FROM_HERE, | 198 MainThreadTaskRunner()->PostTask( |
| 181 base::Bind(&ProxyMain::DidLoseOutputSurface, | 199 FROM_HERE, |
| 182 proxy_main_->GetMainWeakPtr())); | 200 base::Bind(&ProxyMain::DidLoseOutputSurface, proxy_main_->GetWeakPtr())); |
| 183 } | 201 } |
| 184 | 202 |
| 185 void ThreadedChannel::RequestNewOutputSurface() { | 203 void ThreadedChannel::RequestNewOutputSurface() { |
| 186 MainThreadTaskRunner()->PostTask( | 204 MainThreadTaskRunner()->PostTask( |
| 187 FROM_HERE, base::Bind(&ProxyMain::RequestNewOutputSurface, | 205 FROM_HERE, base::Bind(&ProxyMain::RequestNewOutputSurface, |
| 188 proxy_main_->GetMainWeakPtr())); | 206 proxy_main_->GetWeakPtr())); |
| 189 } | 207 } |
| 190 | 208 |
| 191 void ThreadedChannel::DidInitializeOutputSurface( | 209 void ThreadedChannel::DidInitializeOutputSurface( |
| 192 bool success, | 210 bool success, |
| 193 const RendererCapabilities& capabilities) { | 211 const RendererCapabilities& capabilities) { |
| 194 MainThreadTaskRunner()->PostTask( | 212 MainThreadTaskRunner()->PostTask( |
| 195 FROM_HERE, | 213 FROM_HERE, base::Bind(&ProxyMain::DidInitializeOutputSurface, |
| 196 base::Bind(&ProxyMain::DidInitializeOutputSurface, | 214 proxy_main_->GetWeakPtr(), success, capabilities)); |
| 197 proxy_main_->GetMainWeakPtr(), success, capabilities)); | |
| 198 } | 215 } |
| 199 | 216 |
| 200 void ThreadedChannel::DidCompletePageScaleAnimation() { | 217 void ThreadedChannel::DidCompletePageScaleAnimation() { |
| 201 MainThreadTaskRunner()->PostTask( | 218 MainThreadTaskRunner()->PostTask( |
| 202 FROM_HERE, base::Bind(&ProxyMain::DidCompletePageScaleAnimation, | 219 FROM_HERE, base::Bind(&ProxyMain::DidCompletePageScaleAnimation, |
| 203 proxy_main_->GetMainWeakPtr())); | 220 proxy_main_->GetWeakPtr())); |
| 204 } | 221 } |
| 205 | 222 |
| 206 void ThreadedChannel::PostFrameTimingEventsOnMain( | 223 void ThreadedChannel::PostFrameTimingEventsOnMain( |
| 207 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | 224 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
| 208 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { | 225 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { |
| 209 MainThreadTaskRunner()->PostTask( | 226 MainThreadTaskRunner()->PostTask( |
| 210 FROM_HERE, base::Bind(&ProxyMain::PostFrameTimingEventsOnMain, | 227 FROM_HERE, base::Bind(&ProxyMain::PostFrameTimingEventsOnMain, |
| 211 proxy_main_->GetMainWeakPtr(), | 228 proxy_main_->GetWeakPtr(), |
| 212 base::Passed(composite_events.Pass()), | 229 base::Passed(composite_events.Pass()), |
| 213 base::Passed(main_frame_events.Pass()))); | 230 base::Passed(main_frame_events.Pass()))); |
| 214 } | 231 } |
| 215 | 232 |
| 216 void ThreadedChannel::BeginMainFrame( | 233 void ThreadedChannel::BeginMainFrame( |
| 217 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { | 234 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { |
| 218 MainThreadTaskRunner()->PostTask( | 235 MainThreadTaskRunner()->PostTask( |
| 219 FROM_HERE, | 236 FROM_HERE, |
| 220 base::Bind(&ProxyMain::BeginMainFrame, proxy_main_->GetMainWeakPtr(), | 237 base::Bind(&ProxyMain::BeginMainFrame, proxy_main_->GetWeakPtr(), |
| 221 base::Passed(&begin_main_frame_state))); | 238 base::Passed(&begin_main_frame_state))); |
| 222 } | 239 } |
| 223 | 240 |
| 224 ThreadedChannel::~ThreadedChannel() { | 241 ThreadedChannel::~ThreadedChannel() { |
| 225 TRACE_EVENT0("cc", "ThreadChannel::~ThreadChannel"); | 242 TRACE_EVENT0("cc", "ThreadChannel::~ThreadChannel"); |
| 226 } | 243 } |
| 227 | 244 |
| 245 bool ThreadedChannel::IsInitialized() const { |
| 246 return !!proxy_impl_.get(); |
| 247 } |
| 248 |
| 228 base::SingleThreadTaskRunner* ThreadedChannel::MainThreadTaskRunner() const { | 249 base::SingleThreadTaskRunner* ThreadedChannel::MainThreadTaskRunner() const { |
| 229 return main_task_runner_.get(); | 250 return proxy_main_->MainThreadTaskRunner(); |
| 230 } | 251 } |
| 231 | 252 |
| 232 base::SingleThreadTaskRunner* ThreadedChannel::ImplThreadTaskRunner() const { | 253 base::SingleThreadTaskRunner* ThreadedChannel::ImplThreadTaskRunner() const { |
| 233 return impl_task_runner_.get(); | 254 return proxy_main_->ImplThreadTaskRunner(); |
| 234 } | 255 } |
| 235 | 256 |
| 236 } // namespace cc | 257 } // namespace cc |
| OLD | NEW |