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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 this, scheduler_settings, impl().layer_tree_host_id, | 1036 this, scheduler_settings, impl().layer_tree_host_id, |
1038 ImplThreadTaskRunner(), impl().external_begin_frame_source.get(), | 1037 ImplThreadTaskRunner(), impl().external_begin_frame_source.get(), |
1039 compositor_timing_history.Pass()); | 1038 compositor_timing_history.Pass()); |
1040 | 1039 |
1041 impl().scheduler->SetVisible(impl().layer_tree_host_impl->visible()); | 1040 impl().scheduler->SetVisible(impl().layer_tree_host_impl->visible()); |
1042 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr(); | 1041 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr(); |
1043 completion->Signal(); | 1042 completion->Signal(); |
1044 } | 1043 } |
1045 | 1044 |
1046 void ThreadProxy::InitializeOutputSurfaceOnImplThread( | 1045 void ThreadProxy::InitializeOutputSurfaceOnImplThread( |
1047 scoped_ptr<OutputSurface> output_surface) { | 1046 OutputSurface* output_surface) { |
1048 TRACE_EVENT0("cc", "ThreadProxy::InitializeOutputSurfaceOnImplThread"); | 1047 TRACE_EVENT0("cc", "ThreadProxy::InitializeOutputSurfaceOnImplThread"); |
1049 DCHECK(IsImplThread()); | 1048 DCHECK(IsImplThread()); |
1050 | 1049 |
1051 LayerTreeHostImpl* host_impl = impl().layer_tree_host_impl.get(); | 1050 LayerTreeHostImpl* host_impl = impl().layer_tree_host_impl.get(); |
1052 bool success = host_impl->InitializeRenderer(output_surface.Pass()); | 1051 bool success = host_impl->InitializeRenderer(output_surface); |
1053 RendererCapabilities capabilities; | 1052 RendererCapabilities capabilities; |
1054 if (success) { | 1053 if (success) { |
1055 capabilities = | 1054 capabilities = |
1056 host_impl->GetRendererCapabilities().MainThreadCapabilities(); | 1055 host_impl->GetRendererCapabilities().MainThreadCapabilities(); |
1057 } | 1056 } |
1058 | 1057 |
1059 Proxy::MainThreadTaskRunner()->PostTask( | 1058 Proxy::MainThreadTaskRunner()->PostTask( |
1060 FROM_HERE, | 1059 FROM_HERE, |
1061 base::Bind(&ThreadProxy::DidInitializeOutputSurface, | 1060 base::Bind(&ThreadProxy::DidInitializeOutputSurface, |
1062 main_thread_weak_ptr_, | 1061 main_thread_weak_ptr_, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 | 1238 |
1240 void ThreadProxy::PostFrameTimingEvents( | 1239 void ThreadProxy::PostFrameTimingEvents( |
1241 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | 1240 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
1242 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { | 1241 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { |
1243 DCHECK(IsMainThread()); | 1242 DCHECK(IsMainThread()); |
1244 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(), | 1243 layer_tree_host()->RecordFrameTimingEvents(composite_events.Pass(), |
1245 main_frame_events.Pass()); | 1244 main_frame_events.Pass()); |
1246 } | 1245 } |
1247 | 1246 |
1248 } // namespace cc | 1247 } // namespace cc |
OLD | NEW |