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