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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurface"); | 203 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurface"); |
204 DCHECK(IsMainThread()); | 204 DCHECK(IsMainThread()); |
205 layer_tree_host()->DidLoseOutputSurface(); | 205 layer_tree_host()->DidLoseOutputSurface(); |
206 } | 206 } |
207 | 207 |
208 void ThreadProxy::RequestNewOutputSurface() { | 208 void ThreadProxy::RequestNewOutputSurface() { |
209 DCHECK(IsMainThread()); | 209 DCHECK(IsMainThread()); |
210 layer_tree_host()->RequestNewOutputSurface(); | 210 layer_tree_host()->RequestNewOutputSurface(); |
211 } | 211 } |
212 | 212 |
213 void ThreadProxy::SetOutputSurface(scoped_ptr<OutputSurface> output_surface) { | 213 void ThreadProxy::SetOutputSurface(OutputSurface* output_surface) { |
214 Proxy::ImplThreadTaskRunner()->PostTask( | 214 Proxy::ImplThreadTaskRunner()->PostTask( |
215 FROM_HERE, | 215 FROM_HERE, base::Bind(&ThreadProxy::InitializeOutputSurfaceOnImplThread, |
216 base::Bind(&ThreadProxy::InitializeOutputSurfaceOnImplThread, | 216 impl_thread_weak_ptr_, output_surface)); |
217 impl_thread_weak_ptr_, base::Passed(&output_surface))); | |
218 } | 217 } |
219 | 218 |
220 void ThreadProxy::DidInitializeOutputSurface( | 219 void ThreadProxy::DidInitializeOutputSurface( |
221 bool success, | 220 bool success, |
222 const RendererCapabilities& capabilities) { | 221 const RendererCapabilities& capabilities) { |
223 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); | 222 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); |
224 DCHECK(IsMainThread()); | 223 DCHECK(IsMainThread()); |
225 | 224 |
226 if (!success) { | 225 if (!success) { |
227 layer_tree_host()->DidFailToInitializeOutputSurface(); | 226 layer_tree_host()->DidFailToInitializeOutputSurface(); |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 this, scheduler_settings, impl().layer_tree_host_id, | 1050 this, scheduler_settings, impl().layer_tree_host_id, |
1052 ImplThreadTaskRunner(), impl().external_begin_frame_source.get(), | 1051 ImplThreadTaskRunner(), impl().external_begin_frame_source.get(), |
1053 compositor_timing_history.Pass()); | 1052 compositor_timing_history.Pass()); |
1054 | 1053 |
1055 impl().scheduler->SetVisible(impl().layer_tree_host_impl->visible()); | 1054 impl().scheduler->SetVisible(impl().layer_tree_host_impl->visible()); |
1056 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr(); | 1055 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr(); |
1057 completion->Signal(); | 1056 completion->Signal(); |
1058 } | 1057 } |
1059 | 1058 |
1060 void ThreadProxy::InitializeOutputSurfaceOnImplThread( | 1059 void ThreadProxy::InitializeOutputSurfaceOnImplThread( |
1061 scoped_ptr<OutputSurface> output_surface) { | 1060 OutputSurface* output_surface) { |
1062 TRACE_EVENT0("cc", "ThreadProxy::InitializeOutputSurfaceOnImplThread"); | 1061 TRACE_EVENT0("cc", "ThreadProxy::InitializeOutputSurfaceOnImplThread"); |
1063 DCHECK(IsImplThread()); | 1062 DCHECK(IsImplThread()); |
1064 | 1063 |
1065 LayerTreeHostImpl* host_impl = impl().layer_tree_host_impl.get(); | 1064 LayerTreeHostImpl* host_impl = impl().layer_tree_host_impl.get(); |
1066 bool success = host_impl->InitializeRenderer(output_surface.Pass()); | 1065 bool success = host_impl->InitializeRenderer(output_surface); |
1067 RendererCapabilities capabilities; | 1066 RendererCapabilities capabilities; |
1068 if (success) { | 1067 if (success) { |
1069 capabilities = | 1068 capabilities = |
1070 host_impl->GetRendererCapabilities().MainThreadCapabilities(); | 1069 host_impl->GetRendererCapabilities().MainThreadCapabilities(); |
1071 } | 1070 } |
1072 | 1071 |
1073 Proxy::MainThreadTaskRunner()->PostTask( | 1072 Proxy::MainThreadTaskRunner()->PostTask( |
1074 FROM_HERE, | 1073 FROM_HERE, |
1075 base::Bind(&ThreadProxy::DidInitializeOutputSurface, | 1074 base::Bind(&ThreadProxy::DidInitializeOutputSurface, |
1076 main_thread_weak_ptr_, | 1075 main_thread_weak_ptr_, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 | 1252 |
1254 void ThreadProxy::PostFrameTimingEvents( | 1253 void ThreadProxy::PostFrameTimingEvents( |
1255 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | 1254 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
1256 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { | 1255 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { |
1257 DCHECK(IsMainThread()); | 1256 DCHECK(IsMainThread()); |
1258 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(), | 1257 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(), |
1259 main_frame_events.Pass()); | 1258 main_frame_events.Pass()); |
1260 } | 1259 } |
1261 | 1260 |
1262 } // namespace cc | 1261 } // namespace cc |
OLD | NEW |