| 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" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
| 13 #include "base/debug/trace_event_argument.h" | 13 #include "base/debug/trace_event_argument.h" |
| 14 #include "base/debug/trace_event_synthetic_delay.h" | 14 #include "base/debug/trace_event_synthetic_delay.h" |
| 15 #include "cc/base/swap_promise.h" | 15 #include "cc/base/swap_promise.h" |
| 16 #include "cc/debug/benchmark_instrumentation.h" | 16 #include "cc/debug/benchmark_instrumentation.h" |
| 17 #include "cc/debug/devtools_instrumentation.h" | 17 #include "cc/debug/devtools_instrumentation.h" |
| 18 #include "cc/debug/smoothness_timing_tracker.h" |
| 18 #include "cc/input/input_handler.h" | 19 #include "cc/input/input_handler.h" |
| 19 #include "cc/output/context_provider.h" | 20 #include "cc/output/context_provider.h" |
| 20 #include "cc/output/output_surface.h" | 21 #include "cc/output/output_surface.h" |
| 21 #include "cc/quads/draw_quad.h" | 22 #include "cc/quads/draw_quad.h" |
| 22 #include "cc/resources/prioritized_resource_manager.h" | 23 #include "cc/resources/prioritized_resource_manager.h" |
| 23 #include "cc/scheduler/delay_based_time_source.h" | 24 #include "cc/scheduler/delay_based_time_source.h" |
| 24 #include "cc/scheduler/scheduler.h" | 25 #include "cc/scheduler/scheduler.h" |
| 25 #include "cc/trees/blocking_task_runner.h" | 26 #include "cc/trees/blocking_task_runner.h" |
| 26 #include "cc/trees/layer_tree_host.h" | 27 #include "cc/trees/layer_tree_host.h" |
| 27 #include "cc/trees/layer_tree_impl.h" | 28 #include "cc/trees/layer_tree_impl.h" |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 | 698 |
| 698 if (!impl().layer_tree_host_impl->settings().impl_side_painting) { | 699 if (!impl().layer_tree_host_impl->settings().impl_side_painting) { |
| 699 DCHECK_GT(impl().layer_tree_host_impl->memory_allocation_limit_bytes(), 0u); | 700 DCHECK_GT(impl().layer_tree_host_impl->memory_allocation_limit_bytes(), 0u); |
| 700 } | 701 } |
| 701 begin_main_frame_state->memory_allocation_limit_bytes = | 702 begin_main_frame_state->memory_allocation_limit_bytes = |
| 702 impl().layer_tree_host_impl->memory_allocation_limit_bytes(); | 703 impl().layer_tree_host_impl->memory_allocation_limit_bytes(); |
| 703 begin_main_frame_state->memory_allocation_priority_cutoff = | 704 begin_main_frame_state->memory_allocation_priority_cutoff = |
| 704 impl().layer_tree_host_impl->memory_allocation_priority_cutoff(); | 705 impl().layer_tree_host_impl->memory_allocation_priority_cutoff(); |
| 705 begin_main_frame_state->evicted_ui_resources = | 706 begin_main_frame_state->evicted_ui_resources = |
| 706 impl().layer_tree_host_impl->EvictedUIResourcesExist(); | 707 impl().layer_tree_host_impl->EvictedUIResourcesExist(); |
| 708 begin_main_frame_state->smoothness_composite_counts = |
| 709 impl() |
| 710 .layer_tree_host_impl->smoothness_tracker() |
| 711 ->CalculateCompositeCounts(); |
| 712 impl().layer_tree_host_impl->smoothness_tracker()->clear_events(); |
| 713 |
| 707 Proxy::MainThreadTaskRunner()->PostTask( | 714 Proxy::MainThreadTaskRunner()->PostTask( |
| 708 FROM_HERE, | 715 FROM_HERE, |
| 709 base::Bind(&ThreadProxy::BeginMainFrame, | 716 base::Bind(&ThreadProxy::BeginMainFrame, |
| 710 main_thread_weak_ptr_, | 717 main_thread_weak_ptr_, |
| 711 base::Passed(&begin_main_frame_state))); | 718 base::Passed(&begin_main_frame_state))); |
| 712 devtools_instrumentation::DidRequestMainThreadFrame( | 719 devtools_instrumentation::DidRequestMainThreadFrame( |
| 713 impl().layer_tree_host_id); | 720 impl().layer_tree_host_id); |
| 714 impl().timing_history.DidBeginMainFrame(); | 721 impl().timing_history.DidBeginMainFrame(); |
| 715 } | 722 } |
| 716 | 723 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 // On the other hand, the animate_requested flag should remain cleared | 782 // On the other hand, the animate_requested flag should remain cleared |
| 776 // here so that any animation requests generated by the apply or animate | 783 // here so that any animation requests generated by the apply or animate |
| 777 // callbacks will trigger another frame. | 784 // callbacks will trigger another frame. |
| 778 main().commit_requested = true; | 785 main().commit_requested = true; |
| 779 main().commit_request_sent_to_impl_thread = true; | 786 main().commit_request_sent_to_impl_thread = true; |
| 780 VLOG(2) << "ThreadProxy::BeginMainFrame: Commit requests silenced."; | 787 VLOG(2) << "ThreadProxy::BeginMainFrame: Commit requests silenced."; |
| 781 | 788 |
| 782 layer_tree_host()->ApplyScrollAndScale( | 789 layer_tree_host()->ApplyScrollAndScale( |
| 783 begin_main_frame_state->scroll_info.get()); | 790 begin_main_frame_state->scroll_info.get()); |
| 784 | 791 |
| 792 layer_tree_host()->RecordCompositeTiming( |
| 793 *begin_main_frame_state->smoothness_composite_counts); |
| 794 |
| 785 layer_tree_host()->WillBeginMainFrame(); | 795 layer_tree_host()->WillBeginMainFrame(); |
| 786 | 796 |
| 787 layer_tree_host()->BeginMainFrame(begin_main_frame_state->begin_frame_args); | 797 layer_tree_host()->BeginMainFrame(begin_main_frame_state->begin_frame_args); |
| 788 layer_tree_host()->AnimateLayers( | 798 layer_tree_host()->AnimateLayers( |
| 789 begin_main_frame_state->begin_frame_args.frame_time); | 799 begin_main_frame_state->begin_frame_args.frame_time); |
| 790 blocked_main().last_monotonic_frame_begin_time = | 800 blocked_main().last_monotonic_frame_begin_time = |
| 791 begin_main_frame_state->begin_frame_args.frame_time; | 801 begin_main_frame_state->begin_frame_args.frame_time; |
| 792 | 802 |
| 793 // Unlink any backings that the impl thread has evicted, so that we know to | 803 // Unlink any backings that the impl thread has evicted, so that we know to |
| 794 // re-paint them in UpdateLayers. | 804 // re-paint them in UpdateLayers. |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 | 1429 |
| 1420 impl().timing_history.DidActivateSyncTree(); | 1430 impl().timing_history.DidActivateSyncTree(); |
| 1421 } | 1431 } |
| 1422 | 1432 |
| 1423 void ThreadProxy::DidManageTiles() { | 1433 void ThreadProxy::DidManageTiles() { |
| 1424 DCHECK(IsImplThread()); | 1434 DCHECK(IsImplThread()); |
| 1425 impl().scheduler->DidManageTiles(); | 1435 impl().scheduler->DidManageTiles(); |
| 1426 } | 1436 } |
| 1427 | 1437 |
| 1428 } // namespace cc | 1438 } // namespace cc |
| OLD | NEW |