| 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 } | 436 } |
| 437 | 437 |
| 438 void ThreadProxy::OnSwapBuffersCompleteOnImplThread() { | 438 void ThreadProxy::OnSwapBuffersCompleteOnImplThread() { |
| 439 TRACE_EVENT0("cc", "ThreadProxy::OnSwapBuffersCompleteOnImplThread"); | 439 TRACE_EVENT0("cc", "ThreadProxy::OnSwapBuffersCompleteOnImplThread"); |
| 440 DCHECK(IsImplThread()); | 440 DCHECK(IsImplThread()); |
| 441 Proxy::MainThreadTaskRunner()->PostTask( | 441 Proxy::MainThreadTaskRunner()->PostTask( |
| 442 FROM_HERE, | 442 FROM_HERE, |
| 443 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); | 443 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); |
| 444 } | 444 } |
| 445 | 445 |
| 446 void ThreadProxy::SetNeedsBeginImplFrame(bool enable) { | 446 void ThreadProxy::SetNeedsBeginFrame(bool enable) { |
| 447 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginImplFrame", "enable", enable); | 447 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginFrame", "enable", enable); |
| 448 DCHECK(IsImplThread()); | 448 DCHECK(IsImplThread()); |
| 449 impl().layer_tree_host_impl->SetNeedsBeginImplFrame(enable); | 449 impl().layer_tree_host_impl->SetNeedsBeginFrame(enable); |
| 450 UpdateBackgroundAnimateTicking(); | 450 UpdateBackgroundAnimateTicking(); |
| 451 } | 451 } |
| 452 | 452 |
| 453 void ThreadProxy::BeginImplFrame(const BeginFrameArgs& args) { | 453 void ThreadProxy::BeginFrame(const BeginFrameArgs& args) { |
| 454 TRACE_EVENT0("cc", "ThreadProxy::BeginImplFrame"); | |
| 455 DCHECK(IsImplThread()); | 454 DCHECK(IsImplThread()); |
| 455 impl().scheduler->BeginFrame(args); |
| 456 } |
| 456 | 457 |
| 457 // Sample the frame time now. This time will be used for updating animations | 458 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { |
| 458 // when we draw. | 459 impl().layer_tree_host_impl->WillBeginImplFrame(args); |
| 459 impl().layer_tree_host_impl->UpdateCurrentFrameTime(); | |
| 460 | |
| 461 impl().scheduler->BeginImplFrame(args); | |
| 462 } | 460 } |
| 463 | 461 |
| 464 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 462 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
| 465 TRACE_EVENT1( | 463 TRACE_EVENT1( |
| 466 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 464 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
| 467 DCHECK(IsImplThread()); | 465 DCHECK(IsImplThread()); |
| 468 impl().scheduler->SetCanDraw(can_draw); | 466 impl().scheduler->SetCanDraw(can_draw); |
| 469 UpdateBackgroundAnimateTicking(); | 467 UpdateBackgroundAnimateTicking(); |
| 470 } | 468 } |
| 471 | 469 |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 BlockingTaskRunner::CapturePostTasks blocked; | 972 BlockingTaskRunner::CapturePostTasks blocked; |
| 975 | 973 |
| 976 CompletionEvent completion; | 974 CompletionEvent completion; |
| 977 Proxy::ImplThreadTaskRunner()->PostTask( | 975 Proxy::ImplThreadTaskRunner()->PostTask( |
| 978 FROM_HERE, | 976 FROM_HERE, |
| 979 base::Bind(&ThreadProxy::StartCommitOnImplThread, | 977 base::Bind(&ThreadProxy::StartCommitOnImplThread, |
| 980 impl_thread_weak_ptr_, | 978 impl_thread_weak_ptr_, |
| 981 &completion, | 979 &completion, |
| 982 queue.release(), | 980 queue.release(), |
| 983 offscreen_context_provider)); | 981 offscreen_context_provider)); |
| 982 |
| 984 completion.Wait(); | 983 completion.Wait(); |
| 985 | 984 |
| 986 RenderingStatsInstrumentation* stats_instrumentation = | 985 RenderingStatsInstrumentation* stats_instrumentation = |
| 987 layer_tree_host()->rendering_stats_instrumentation(); | 986 layer_tree_host()->rendering_stats_instrumentation(); |
| 988 BenchmarkInstrumentation::IssueMainThreadRenderingStatsEvent( | 987 BenchmarkInstrumentation::IssueMainThreadRenderingStatsEvent( |
| 989 stats_instrumentation->main_thread_rendering_stats()); | 988 stats_instrumentation->main_thread_rendering_stats()); |
| 990 stats_instrumentation->AccumulateAndClearMainThreadStats(); | 989 stats_instrumentation->AccumulateAndClearMainThreadStats(); |
| 991 } | 990 } |
| 992 | 991 |
| 993 layer_tree_host()->CommitComplete(); | 992 layer_tree_host()->CommitComplete(); |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1536 impl().layer_tree_host_impl->resource_provider()->Finish(); | 1535 impl().layer_tree_host_impl->resource_provider()->Finish(); |
| 1537 completion->Signal(); | 1536 completion->Signal(); |
| 1538 } | 1537 } |
| 1539 | 1538 |
| 1540 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { | 1539 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { |
| 1541 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); | 1540 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); |
| 1542 DCHECK(IsImplThread()); | 1541 DCHECK(IsImplThread()); |
| 1543 layer_tree_host()->DeleteContentsTexturesOnImplThread( | 1542 layer_tree_host()->DeleteContentsTexturesOnImplThread( |
| 1544 impl().layer_tree_host_impl->resource_provider()); | 1543 impl().layer_tree_host_impl->resource_provider()); |
| 1545 impl().current_resource_update_controller.reset(); | 1544 impl().current_resource_update_controller.reset(); |
| 1546 impl().layer_tree_host_impl->SetNeedsBeginImplFrame(false); | 1545 impl().layer_tree_host_impl->SetNeedsBeginFrame(false); |
| 1547 impl().scheduler.reset(); | 1546 impl().scheduler.reset(); |
| 1548 impl().layer_tree_host_impl.reset(); | 1547 impl().layer_tree_host_impl.reset(); |
| 1549 impl().weak_factory.InvalidateWeakPtrs(); | 1548 impl().weak_factory.InvalidateWeakPtrs(); |
| 1550 impl().contents_texture_manager = NULL; | 1549 impl().contents_texture_manager = NULL; |
| 1551 completion->Signal(); | 1550 completion->Signal(); |
| 1552 } | 1551 } |
| 1553 | 1552 |
| 1554 size_t ThreadProxy::MaxPartialTextureUpdates() const { | 1553 size_t ThreadProxy::MaxPartialTextureUpdates() const { |
| 1555 return ResourceUpdateController::MaxPartialTextureUpdates(); | 1554 return ResourceUpdateController::MaxPartialTextureUpdates(); |
| 1556 } | 1555 } |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1741 | 1740 |
| 1742 impl().timing_history.DidActivatePendingTree(); | 1741 impl().timing_history.DidActivatePendingTree(); |
| 1743 } | 1742 } |
| 1744 | 1743 |
| 1745 void ThreadProxy::DidManageTiles() { | 1744 void ThreadProxy::DidManageTiles() { |
| 1746 DCHECK(IsImplThread()); | 1745 DCHECK(IsImplThread()); |
| 1747 impl().scheduler->DidManageTiles(); | 1746 impl().scheduler->DidManageTiles(); |
| 1748 } | 1747 } |
| 1749 | 1748 |
| 1750 } // namespace cc | 1749 } // namespace cc |
| OLD | NEW |