| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 CompletionEvent completion; | 208 CompletionEvent completion; |
| 209 Proxy::ImplThreadTaskRunner()->PostTask( | 209 Proxy::ImplThreadTaskRunner()->PostTask( |
| 210 FROM_HERE, | 210 FROM_HERE, |
| 211 base::Bind(&ThreadProxy::DeleteContentsTexturesOnImplThread, | 211 base::Bind(&ThreadProxy::DeleteContentsTexturesOnImplThread, |
| 212 impl_thread_weak_ptr_, | 212 impl_thread_weak_ptr_, |
| 213 &completion)); | 213 &completion)); |
| 214 completion.Wait(); | 214 completion.Wait(); |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 void ThreadProxy::RequestNewOutputSurface() { | 218 void ThreadProxy::CreateAndInitializeOutputSurface() { |
| 219 TRACE_EVENT0("cc", "ThreadProxy::DoCreateAndInitializeOutputSurface"); |
| 219 DCHECK(IsMainThread()); | 220 DCHECK(IsMainThread()); |
| 220 layer_tree_host()->RequestNewOutputSurface(); | |
| 221 } | |
| 222 | 221 |
| 223 void ThreadProxy::SetOutputSurface(scoped_ptr<OutputSurface> output_surface) { | 222 scoped_ptr<OutputSurface> output_surface = |
| 223 layer_tree_host()->CreateOutputSurface(); |
| 224 |
| 224 if (output_surface) { | 225 if (output_surface) { |
| 225 Proxy::ImplThreadTaskRunner()->PostTask( | 226 Proxy::ImplThreadTaskRunner()->PostTask( |
| 226 FROM_HERE, | 227 FROM_HERE, |
| 227 base::Bind(&ThreadProxy::InitializeOutputSurfaceOnImplThread, | 228 base::Bind(&ThreadProxy::InitializeOutputSurfaceOnImplThread, |
| 228 impl_thread_weak_ptr_, | 229 impl_thread_weak_ptr_, |
| 229 base::Passed(&output_surface))); | 230 base::Passed(&output_surface))); |
| 230 return; | 231 return; |
| 231 } | 232 } |
| 232 | 233 |
| 233 DidInitializeOutputSurface(false, RendererCapabilities()); | 234 DidInitializeOutputSurface(false, RendererCapabilities()); |
| 234 } | 235 } |
| 235 | 236 |
| 236 void ThreadProxy::DidInitializeOutputSurface( | 237 void ThreadProxy::DidInitializeOutputSurface( |
| 237 bool success, | 238 bool success, |
| 238 const RendererCapabilities& capabilities) { | 239 const RendererCapabilities& capabilities) { |
| 239 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); | 240 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); |
| 240 DCHECK(IsMainThread()); | 241 DCHECK(IsMainThread()); |
| 241 main().renderer_capabilities_main_thread_copy = capabilities; | 242 main().renderer_capabilities_main_thread_copy = capabilities; |
| 242 layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(success); | 243 layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(success); |
| 243 | 244 |
| 244 if (!success) { | 245 if (!success) { |
| 245 Proxy::MainThreadTaskRunner()->PostTask( | 246 Proxy::MainThreadTaskRunner()->PostTask( |
| 246 FROM_HERE, | 247 FROM_HERE, |
| 247 base::Bind(&ThreadProxy::RequestNewOutputSurface, | 248 base::Bind(&ThreadProxy::CreateAndInitializeOutputSurface, |
| 248 main_thread_weak_ptr_)); | 249 main_thread_weak_ptr_)); |
| 249 } | 250 } |
| 250 } | 251 } |
| 251 | 252 |
| 252 void ThreadProxy::SetRendererCapabilitiesMainThreadCopy( | 253 void ThreadProxy::SetRendererCapabilitiesMainThreadCopy( |
| 253 const RendererCapabilities& capabilities) { | 254 const RendererCapabilities& capabilities) { |
| 254 main().renderer_capabilities_main_thread_copy = capabilities; | 255 main().renderer_capabilities_main_thread_copy = capabilities; |
| 255 } | 256 } |
| 256 | 257 |
| 257 void ThreadProxy::SendCommitRequestToImplThreadIfNeeded() { | 258 void ThreadProxy::SendCommitRequestToImplThreadIfNeeded() { |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionActivateSyncTree"); | 1019 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionActivateSyncTree"); |
| 1019 DCHECK(IsImplThread()); | 1020 DCHECK(IsImplThread()); |
| 1020 impl().layer_tree_host_impl->ActivateSyncTree(); | 1021 impl().layer_tree_host_impl->ActivateSyncTree(); |
| 1021 } | 1022 } |
| 1022 | 1023 |
| 1023 void ThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { | 1024 void ThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { |
| 1024 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionBeginOutputSurfaceCreation"); | 1025 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionBeginOutputSurfaceCreation"); |
| 1025 DCHECK(IsImplThread()); | 1026 DCHECK(IsImplThread()); |
| 1026 Proxy::MainThreadTaskRunner()->PostTask( | 1027 Proxy::MainThreadTaskRunner()->PostTask( |
| 1027 FROM_HERE, | 1028 FROM_HERE, |
| 1028 base::Bind(&ThreadProxy::RequestNewOutputSurface, main_thread_weak_ptr_)); | 1029 base::Bind(&ThreadProxy::CreateAndInitializeOutputSurface, |
| 1030 main_thread_weak_ptr_)); |
| 1029 } | 1031 } |
| 1030 | 1032 |
| 1031 DrawResult ThreadProxy::DrawSwapInternal(bool forced_draw) { | 1033 DrawResult ThreadProxy::DrawSwapInternal(bool forced_draw) { |
| 1032 TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap"); | 1034 TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap"); |
| 1033 DrawResult result; | 1035 DrawResult result; |
| 1034 | 1036 |
| 1035 DCHECK(IsImplThread()); | 1037 DCHECK(IsImplThread()); |
| 1036 DCHECK(impl().layer_tree_host_impl.get()); | 1038 DCHECK(impl().layer_tree_host_impl.get()); |
| 1037 | 1039 |
| 1038 impl().timing_history.DidStartDrawing(); | 1040 impl().timing_history.DidStartDrawing(); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 | 1403 |
| 1402 impl().timing_history.DidActivateSyncTree(); | 1404 impl().timing_history.DidActivateSyncTree(); |
| 1403 } | 1405 } |
| 1404 | 1406 |
| 1405 void ThreadProxy::DidManageTiles() { | 1407 void ThreadProxy::DidManageTiles() { |
| 1406 DCHECK(IsImplThread()); | 1408 DCHECK(IsImplThread()); |
| 1407 impl().scheduler->DidManageTiles(); | 1409 impl().scheduler->DidManageTiles(); |
| 1408 } | 1410 } |
| 1409 | 1411 |
| 1410 } // namespace cc | 1412 } // namespace cc |
| OLD | NEW |