| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/thread_proxy.h" | 5 #include "cc/trees/thread_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 DCHECK(Proxy::IsMainThread()); | 151 DCHECK(Proxy::IsMainThread()); |
| 152 return main().started; | 152 return main().started; |
| 153 } | 153 } |
| 154 | 154 |
| 155 bool ThreadProxy::CommitToActiveTree() const { | 155 bool ThreadProxy::CommitToActiveTree() const { |
| 156 // With ThreadProxy, we use a pending tree and activate it once it's ready to | 156 // With ThreadProxy, we use a pending tree and activate it once it's ready to |
| 157 // draw to allow input to modify the active tree and draw during raster. | 157 // draw to allow input to modify the active tree and draw during raster. |
| 158 return false; | 158 return false; |
| 159 } | 159 } |
| 160 | 160 |
| 161 void ThreadProxy::SetLayerTreeHostClientReady() { | |
| 162 TRACE_EVENT0("cc", "ThreadProxy::SetLayerTreeHostClientReady"); | |
| 163 main().channel_main->SetLayerTreeHostClientReadyOnImpl(); | |
| 164 } | |
| 165 | |
| 166 void ThreadProxy::SetLayerTreeHostClientReadyOnImpl() { | |
| 167 TRACE_EVENT0("cc", "ThreadProxy::SetLayerTreeHostClientReadyOnImplThread"); | |
| 168 impl().scheduler->SetCanStart(); | |
| 169 } | |
| 170 | |
| 171 void ThreadProxy::SetVisible(bool visible) { | 161 void ThreadProxy::SetVisible(bool visible) { |
| 172 TRACE_EVENT1("cc", "ThreadProxy::SetVisible", "visible", visible); | 162 TRACE_EVENT1("cc", "ThreadProxy::SetVisible", "visible", visible); |
| 173 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 163 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
| 174 | 164 |
| 175 CompletionEvent completion; | 165 CompletionEvent completion; |
| 176 Proxy::ImplThreadTaskRunner()->PostTask( | 166 Proxy::ImplThreadTaskRunner()->PostTask( |
| 177 FROM_HERE, | 167 FROM_HERE, |
| 178 base::Bind(&ThreadProxy::SetVisibleOnImplThread, | 168 base::Bind(&ThreadProxy::SetVisibleOnImplThread, |
| 179 impl_thread_weak_ptr_, | 169 impl_thread_weak_ptr_, |
| 180 &completion, | 170 &completion, |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 | 1020 |
| 1031 scoped_ptr<CompositorTimingHistory> compositor_timing_history( | 1021 scoped_ptr<CompositorTimingHistory> compositor_timing_history( |
| 1032 new CompositorTimingHistory(CompositorTimingHistory::RENDERER_UMA, | 1022 new CompositorTimingHistory(CompositorTimingHistory::RENDERER_UMA, |
| 1033 impl().rendering_stats_instrumentation)); | 1023 impl().rendering_stats_instrumentation)); |
| 1034 | 1024 |
| 1035 impl().scheduler = Scheduler::Create( | 1025 impl().scheduler = Scheduler::Create( |
| 1036 this, scheduler_settings, impl().layer_tree_host_id, | 1026 this, scheduler_settings, impl().layer_tree_host_id, |
| 1037 ImplThreadTaskRunner(), impl().external_begin_frame_source.get(), | 1027 ImplThreadTaskRunner(), impl().external_begin_frame_source.get(), |
| 1038 compositor_timing_history.Pass()); | 1028 compositor_timing_history.Pass()); |
| 1039 | 1029 |
| 1040 impl().scheduler->SetVisible(impl().layer_tree_host_impl->visible()); | 1030 DCHECK_EQ(impl().scheduler->visible(), |
| 1031 impl().layer_tree_host_impl->visible()); |
| 1041 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr(); | 1032 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr(); |
| 1042 completion->Signal(); | 1033 completion->Signal(); |
| 1043 } | 1034 } |
| 1044 | 1035 |
| 1045 void ThreadProxy::InitializeOutputSurfaceOnImplThread( | 1036 void ThreadProxy::InitializeOutputSurfaceOnImplThread( |
| 1046 OutputSurface* output_surface) { | 1037 OutputSurface* output_surface) { |
| 1047 TRACE_EVENT0("cc", "ThreadProxy::InitializeOutputSurfaceOnImplThread"); | 1038 TRACE_EVENT0("cc", "ThreadProxy::InitializeOutputSurfaceOnImplThread"); |
| 1048 DCHECK(IsImplThread()); | 1039 DCHECK(IsImplThread()); |
| 1049 | 1040 |
| 1050 LayerTreeHostImpl* host_impl = impl().layer_tree_host_impl.get(); | 1041 LayerTreeHostImpl* host_impl = impl().layer_tree_host_impl.get(); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 | 1248 |
| 1258 base::WeakPtr<ProxyMain> ThreadProxy::GetMainWeakPtr() { | 1249 base::WeakPtr<ProxyMain> ThreadProxy::GetMainWeakPtr() { |
| 1259 return main_thread_weak_ptr_; | 1250 return main_thread_weak_ptr_; |
| 1260 } | 1251 } |
| 1261 | 1252 |
| 1262 base::WeakPtr<ProxyImpl> ThreadProxy::GetImplWeakPtr() { | 1253 base::WeakPtr<ProxyImpl> ThreadProxy::GetImplWeakPtr() { |
| 1263 return impl_thread_weak_ptr_; | 1254 return impl_thread_weak_ptr_; |
| 1264 } | 1255 } |
| 1265 | 1256 |
| 1266 } // namespace cc | 1257 } // namespace cc |
| OLD | NEW |