| 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 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 } | 1196 } |
| 1197 | 1197 |
| 1198 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { | 1198 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { |
| 1199 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); | 1199 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); |
| 1200 DCHECK(IsImplThread()); | 1200 DCHECK(IsImplThread()); |
| 1201 impl().layer_tree_host_impl = | 1201 impl().layer_tree_host_impl = |
| 1202 layer_tree_host()->CreateLayerTreeHostImpl(this); | 1202 layer_tree_host()->CreateLayerTreeHostImpl(this); |
| 1203 SchedulerSettings scheduler_settings( | 1203 SchedulerSettings scheduler_settings( |
| 1204 layer_tree_host()->settings().ToSchedulerSettings()); | 1204 layer_tree_host()->settings().ToSchedulerSettings()); |
| 1205 impl().scheduler = Scheduler::Create( | 1205 impl().scheduler = Scheduler::Create( |
| 1206 this, | 1206 this, scheduler_settings, impl().layer_tree_host_id, |
| 1207 scheduler_settings, | 1207 ImplThreadTaskRunner(), impl().external_begin_frame_source.get()); |
| 1208 impl().layer_tree_host_id, | |
| 1209 ImplThreadTaskRunner(), | |
| 1210 impl().external_begin_frame_source.Pass()); | |
| 1211 impl().scheduler->SetVisible(impl().layer_tree_host_impl->visible()); | 1208 impl().scheduler->SetVisible(impl().layer_tree_host_impl->visible()); |
| 1212 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr(); | 1209 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr(); |
| 1213 completion->Signal(); | 1210 completion->Signal(); |
| 1214 } | 1211 } |
| 1215 | 1212 |
| 1216 void ThreadProxy::DeleteContentsTexturesOnImplThread( | 1213 void ThreadProxy::DeleteContentsTexturesOnImplThread( |
| 1217 CompletionEvent* completion) { | 1214 CompletionEvent* completion) { |
| 1218 TRACE_EVENT0("cc", "ThreadProxy::DeleteContentsTexturesOnImplThread"); | 1215 TRACE_EVENT0("cc", "ThreadProxy::DeleteContentsTexturesOnImplThread"); |
| 1219 DCHECK(IsImplThread()); | 1216 DCHECK(IsImplThread()); |
| 1220 DCHECK(IsMainThreadBlocked()); | 1217 DCHECK(IsMainThreadBlocked()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 } | 1257 } |
| 1261 | 1258 |
| 1262 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { | 1259 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { |
| 1263 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); | 1260 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); |
| 1264 DCHECK(IsImplThread()); | 1261 DCHECK(IsImplThread()); |
| 1265 DCHECK(IsMainThreadBlocked()); | 1262 DCHECK(IsMainThreadBlocked()); |
| 1266 layer_tree_host()->DeleteContentsTexturesOnImplThread( | 1263 layer_tree_host()->DeleteContentsTexturesOnImplThread( |
| 1267 impl().layer_tree_host_impl->resource_provider()); | 1264 impl().layer_tree_host_impl->resource_provider()); |
| 1268 impl().current_resource_update_controller = nullptr; | 1265 impl().current_resource_update_controller = nullptr; |
| 1269 impl().scheduler = nullptr; | 1266 impl().scheduler = nullptr; |
| 1267 impl().external_begin_frame_source = nullptr; |
| 1270 impl().layer_tree_host_impl = nullptr; | 1268 impl().layer_tree_host_impl = nullptr; |
| 1271 impl().weak_factory.InvalidateWeakPtrs(); | 1269 impl().weak_factory.InvalidateWeakPtrs(); |
| 1272 // We need to explicitly shutdown the notifier to destroy any weakptrs it is | 1270 // We need to explicitly shutdown the notifier to destroy any weakptrs it is |
| 1273 // holding while still on the compositor thread. This also ensures any | 1271 // holding while still on the compositor thread. This also ensures any |
| 1274 // callbacks holding a ThreadProxy pointer are cancelled. | 1272 // callbacks holding a ThreadProxy pointer are cancelled. |
| 1275 impl().smoothness_priority_expiration_notifier.Shutdown(); | 1273 impl().smoothness_priority_expiration_notifier.Shutdown(); |
| 1276 impl().contents_texture_manager = NULL; | 1274 impl().contents_texture_manager = NULL; |
| 1277 completion->Signal(); | 1275 completion->Signal(); |
| 1278 } | 1276 } |
| 1279 | 1277 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 | 1423 |
| 1426 void ThreadProxy::PostFrameTimingEvents( | 1424 void ThreadProxy::PostFrameTimingEvents( |
| 1427 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | 1425 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
| 1428 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { | 1426 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { |
| 1429 DCHECK(IsMainThread()); | 1427 DCHECK(IsMainThread()); |
| 1430 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(), | 1428 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(), |
| 1431 main_frame_events.Pass()); | 1429 main_frame_events.Pass()); |
| 1432 } | 1430 } |
| 1433 | 1431 |
| 1434 } // namespace cc | 1432 } // namespace cc |
| OLD | NEW |