| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 base::Passed(&output_surface), | 304 base::Passed(&output_surface), |
| 305 offscreen_context_provider, | 305 offscreen_context_provider, |
| 306 &success, | 306 &success, |
| 307 &capabilities)); | 307 &capabilities)); |
| 308 completion.Wait(); | 308 completion.Wait(); |
| 309 } | 309 } |
| 310 | 310 |
| 311 OnOutputSurfaceInitializeAttempted(success, capabilities); | 311 OnOutputSurfaceInitializeAttempted(success, capabilities); |
| 312 } | 312 } |
| 313 | 313 |
| 314 void ThreadProxy::SetRendererCapabilitiesMainThreadCopy( |
| 315 const RendererCapabilities& capabilities) { |
| 316 renderer_capabilities_main_thread_copy_ = capabilities; |
| 317 } |
| 318 |
| 314 void ThreadProxy::OnOutputSurfaceInitializeAttempted( | 319 void ThreadProxy::OnOutputSurfaceInitializeAttempted( |
| 315 bool success, | 320 bool success, |
| 316 const RendererCapabilities& capabilities) { | 321 const RendererCapabilities& capabilities) { |
| 317 DCHECK(IsMainThread()); | 322 DCHECK(IsMainThread()); |
| 318 DCHECK(layer_tree_host()); | 323 DCHECK(layer_tree_host()); |
| 319 | 324 |
| 320 if (success) { | 325 if (success) { |
| 321 renderer_capabilities_main_thread_copy_ = capabilities; | 326 SetRendererCapabilitiesMainThreadCopy(capabilities); |
| 322 } | 327 } |
| 323 | 328 |
| 324 LayerTreeHost::CreateResult result = | 329 LayerTreeHost::CreateResult result = |
| 325 layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(success); | 330 layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(success); |
| 326 if (result == LayerTreeHost::CreateFailedButTryAgain) { | 331 if (result == LayerTreeHost::CreateFailedButTryAgain) { |
| 327 if (!output_surface_creation_callback_.callback().is_null()) { | 332 if (!output_surface_creation_callback_.callback().is_null()) { |
| 328 Proxy::MainThreadTaskRunner()->PostTask( | 333 Proxy::MainThreadTaskRunner()->PostTask( |
| 329 FROM_HERE, output_surface_creation_callback_.callback()); | 334 FROM_HERE, output_surface_creation_callback_.callback()); |
| 330 } | 335 } |
| 331 } else { | 336 } else { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 378 |
| 374 void ThreadProxy::SetNeedsCommit() { | 379 void ThreadProxy::SetNeedsCommit() { |
| 375 DCHECK(IsMainThread()); | 380 DCHECK(IsMainThread()); |
| 376 // Unconditionally set here to handle SetNeedsCommit calls during a commit. | 381 // Unconditionally set here to handle SetNeedsCommit calls during a commit. |
| 377 can_cancel_commit_ = false; | 382 can_cancel_commit_ = false; |
| 378 | 383 |
| 379 if (commit_requested_) | 384 if (commit_requested_) |
| 380 return; | 385 return; |
| 381 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommit"); | 386 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommit"); |
| 382 commit_requested_ = true; | 387 commit_requested_ = true; |
| 388 SendCommitRequestToImplThreadIfNeeded(); |
| 389 } |
| 383 | 390 |
| 384 SendCommitRequestToImplThreadIfNeeded(); | 391 void ThreadProxy::UpdateRendererCapabilitiesOnImplThread() { |
| 392 DCHECK(IsImplThread()); |
| 393 // We don't clear PrioritizedResourceManager. |
| 394 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
| 395 |
| 396 Proxy::MainThreadTaskRunner()->PostTask( |
| 397 FROM_HERE, |
| 398 base::Bind(&ThreadProxy::SetRendererCapabilitiesMainThreadCopy, |
| 399 main_thread_weak_ptr_, |
| 400 layer_tree_host_impl_->GetRendererCapabilities() |
| 401 .MainThreadCapabilities())); |
| 385 } | 402 } |
| 386 | 403 |
| 387 void ThreadProxy::DidLoseOutputSurfaceOnImplThread() { | 404 void ThreadProxy::DidLoseOutputSurfaceOnImplThread() { |
| 388 DCHECK(IsImplThread()); | 405 DCHECK(IsImplThread()); |
| 389 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurfaceOnImplThread"); | 406 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurfaceOnImplThread"); |
| 390 CheckOutputSurfaceStatusOnImplThread(); | 407 CheckOutputSurfaceStatusOnImplThread(); |
| 391 } | 408 } |
| 392 | 409 |
| 393 void ThreadProxy::CheckOutputSurfaceStatusOnImplThread() { | 410 void ThreadProxy::CheckOutputSurfaceStatusOnImplThread() { |
| 394 DCHECK(IsImplThread()); | 411 DCHECK(IsImplThread()); |
| (...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1649 commit_to_activate_duration_history_.InsertSample( | 1666 commit_to_activate_duration_history_.InsertSample( |
| 1650 base::TimeTicks::HighResNow() - commit_complete_time_); | 1667 base::TimeTicks::HighResNow() - commit_complete_time_); |
| 1651 } | 1668 } |
| 1652 | 1669 |
| 1653 void ThreadProxy::DidManageTiles() { | 1670 void ThreadProxy::DidManageTiles() { |
| 1654 DCHECK(IsImplThread()); | 1671 DCHECK(IsImplThread()); |
| 1655 scheduler_on_impl_thread_->DidManageTiles(); | 1672 scheduler_on_impl_thread_->DidManageTiles(); |
| 1656 } | 1673 } |
| 1657 | 1674 |
| 1658 } // namespace cc | 1675 } // namespace cc |
| OLD | NEW |