| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 completion.Wait(); | 207 completion.Wait(); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 void ThreadProxy::RequestNewOutputSurface() { | 211 void ThreadProxy::RequestNewOutputSurface() { |
| 212 DCHECK(IsMainThread()); | 212 DCHECK(IsMainThread()); |
| 213 layer_tree_host()->RequestNewOutputSurface(); | 213 layer_tree_host()->RequestNewOutputSurface(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void ThreadProxy::SetOutputSurface(scoped_ptr<OutputSurface> output_surface) { | 216 void ThreadProxy::SetOutputSurface(scoped_ptr<OutputSurface> output_surface) { |
| 217 if (output_surface) { | 217 Proxy::ImplThreadTaskRunner()->PostTask( |
| 218 Proxy::ImplThreadTaskRunner()->PostTask( | 218 FROM_HERE, |
| 219 FROM_HERE, | 219 base::Bind(&ThreadProxy::InitializeOutputSurfaceOnImplThread, |
| 220 base::Bind(&ThreadProxy::InitializeOutputSurfaceOnImplThread, | 220 impl_thread_weak_ptr_, base::Passed(&output_surface))); |
| 221 impl_thread_weak_ptr_, | |
| 222 base::Passed(&output_surface))); | |
| 223 return; | |
| 224 } | |
| 225 | |
| 226 DidInitializeOutputSurface(false, RendererCapabilities()); | |
| 227 } | 221 } |
| 228 | 222 |
| 229 void ThreadProxy::DidInitializeOutputSurface( | 223 void ThreadProxy::DidInitializeOutputSurface( |
| 230 bool success, | 224 bool success, |
| 231 const RendererCapabilities& capabilities) { | 225 const RendererCapabilities& capabilities) { |
| 232 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); | 226 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); |
| 233 DCHECK(IsMainThread()); | 227 DCHECK(IsMainThread()); |
| 234 main().renderer_capabilities_main_thread_copy = capabilities; | |
| 235 layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(success); | |
| 236 | 228 |
| 237 if (!success) { | 229 if (!success) { |
| 238 Proxy::MainThreadTaskRunner()->PostTask( | 230 layer_tree_host()->DidFailToInitializeOutputSurface(); |
| 239 FROM_HERE, | 231 return; |
| 240 base::Bind(&ThreadProxy::RequestNewOutputSurface, | |
| 241 main_thread_weak_ptr_)); | |
| 242 } | 232 } |
| 233 main().renderer_capabilities_main_thread_copy = capabilities; |
| 234 layer_tree_host()->DidInitializeOutputSurface(); |
| 243 } | 235 } |
| 244 | 236 |
| 245 void ThreadProxy::SetRendererCapabilitiesMainThreadCopy( | 237 void ThreadProxy::SetRendererCapabilitiesMainThreadCopy( |
| 246 const RendererCapabilities& capabilities) { | 238 const RendererCapabilities& capabilities) { |
| 247 main().renderer_capabilities_main_thread_copy = capabilities; | 239 main().renderer_capabilities_main_thread_copy = capabilities; |
| 248 } | 240 } |
| 249 | 241 |
| 250 void ThreadProxy::SendCommitRequestToImplThreadIfNeeded() { | 242 void ThreadProxy::SendCommitRequestToImplThreadIfNeeded() { |
| 251 DCHECK(IsMainThread()); | 243 DCHECK(IsMainThread()); |
| 252 if (main().commit_request_sent_to_impl_thread) | 244 if (main().commit_request_sent_to_impl_thread) |
| (...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 | 1333 |
| 1342 impl().timing_history.DidActivateSyncTree(); | 1334 impl().timing_history.DidActivateSyncTree(); |
| 1343 } | 1335 } |
| 1344 | 1336 |
| 1345 void ThreadProxy::DidManageTiles() { | 1337 void ThreadProxy::DidManageTiles() { |
| 1346 DCHECK(IsImplThread()); | 1338 DCHECK(IsImplThread()); |
| 1347 impl().scheduler->DidManageTiles(); | 1339 impl().scheduler->DidManageTiles(); |
| 1348 } | 1340 } |
| 1349 | 1341 |
| 1350 } // namespace cc | 1342 } // namespace cc |
| OLD | NEW |