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 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 } | 1078 } |
1079 | 1079 |
1080 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { | 1080 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { |
1081 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); | 1081 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); |
1082 DCHECK(IsImplThread()); | 1082 DCHECK(IsImplThread()); |
1083 impl().layer_tree_host_impl = | 1083 impl().layer_tree_host_impl = |
1084 layer_tree_host()->CreateLayerTreeHostImpl(this); | 1084 layer_tree_host()->CreateLayerTreeHostImpl(this); |
1085 SchedulerSettings scheduler_settings( | 1085 SchedulerSettings scheduler_settings( |
1086 layer_tree_host()->settings().ToSchedulerSettings()); | 1086 layer_tree_host()->settings().ToSchedulerSettings()); |
1087 impl().scheduler = Scheduler::Create( | 1087 impl().scheduler = Scheduler::Create( |
1088 this, | 1088 this, scheduler_settings, impl().layer_tree_host_id, |
1089 scheduler_settings, | 1089 ImplThreadTaskRunner(), impl().external_begin_frame_source.get()); |
1090 impl().layer_tree_host_id, | |
1091 ImplThreadTaskRunner(), | |
1092 impl().external_begin_frame_source.Pass()); | |
1093 impl().scheduler->SetVisible(impl().layer_tree_host_impl->visible()); | 1090 impl().scheduler->SetVisible(impl().layer_tree_host_impl->visible()); |
1094 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr(); | 1091 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr(); |
1095 completion->Signal(); | 1092 completion->Signal(); |
1096 } | 1093 } |
1097 | 1094 |
1098 void ThreadProxy::InitializeOutputSurfaceOnImplThread( | 1095 void ThreadProxy::InitializeOutputSurfaceOnImplThread( |
1099 scoped_ptr<OutputSurface> output_surface) { | 1096 scoped_ptr<OutputSurface> output_surface) { |
1100 TRACE_EVENT0("cc", "ThreadProxy::InitializeOutputSurfaceOnImplThread"); | 1097 TRACE_EVENT0("cc", "ThreadProxy::InitializeOutputSurfaceOnImplThread"); |
1101 DCHECK(IsImplThread()); | 1098 DCHECK(IsImplThread()); |
1102 | 1099 |
(...skipping 26 matching lines...) Expand all Loading... |
1129 context_provider->ContextGL()->Finish(); | 1126 context_provider->ContextGL()->Finish(); |
1130 } | 1127 } |
1131 completion->Signal(); | 1128 completion->Signal(); |
1132 } | 1129 } |
1133 | 1130 |
1134 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { | 1131 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { |
1135 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); | 1132 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); |
1136 DCHECK(IsImplThread()); | 1133 DCHECK(IsImplThread()); |
1137 DCHECK(IsMainThreadBlocked()); | 1134 DCHECK(IsMainThreadBlocked()); |
1138 impl().scheduler = nullptr; | 1135 impl().scheduler = nullptr; |
| 1136 impl().external_begin_frame_source = nullptr; |
1139 impl().layer_tree_host_impl = nullptr; | 1137 impl().layer_tree_host_impl = nullptr; |
1140 impl().weak_factory.InvalidateWeakPtrs(); | 1138 impl().weak_factory.InvalidateWeakPtrs(); |
1141 // We need to explicitly shutdown the notifier to destroy any weakptrs it is | 1139 // We need to explicitly shutdown the notifier to destroy any weakptrs it is |
1142 // holding while still on the compositor thread. This also ensures any | 1140 // holding while still on the compositor thread. This also ensures any |
1143 // callbacks holding a ThreadProxy pointer are cancelled. | 1141 // callbacks holding a ThreadProxy pointer are cancelled. |
1144 impl().smoothness_priority_expiration_notifier.Shutdown(); | 1142 impl().smoothness_priority_expiration_notifier.Shutdown(); |
1145 completion->Signal(); | 1143 completion->Signal(); |
1146 } | 1144 } |
1147 | 1145 |
1148 ThreadProxy::BeginMainFrameAndCommitState::BeginMainFrameAndCommitState() | 1146 ThreadProxy::BeginMainFrameAndCommitState::BeginMainFrameAndCommitState() |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 | 1285 |
1288 void ThreadProxy::PostFrameTimingEvents( | 1286 void ThreadProxy::PostFrameTimingEvents( |
1289 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | 1287 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
1290 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { | 1288 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { |
1291 DCHECK(IsMainThread()); | 1289 DCHECK(IsMainThread()); |
1292 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(), | 1290 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(), |
1293 main_frame_events.Pass()); | 1291 main_frame_events.Pass()); |
1294 } | 1292 } |
1295 | 1293 |
1296 } // namespace cc | 1294 } // namespace cc |
OLD | NEW |