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" |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "cc/base/swap_promise.h" | 13 #include "cc/base/swap_promise.h" |
14 #include "cc/debug/benchmark_instrumentation.h" | 14 #include "cc/debug/benchmark_instrumentation.h" |
| 15 #include "cc/debug/devtools_instrumentation.h" |
15 #include "cc/input/input_handler.h" | 16 #include "cc/input/input_handler.h" |
16 #include "cc/output/context_provider.h" | 17 #include "cc/output/context_provider.h" |
17 #include "cc/output/output_surface.h" | 18 #include "cc/output/output_surface.h" |
18 #include "cc/quads/draw_quad.h" | 19 #include "cc/quads/draw_quad.h" |
19 #include "cc/resources/prioritized_resource_manager.h" | 20 #include "cc/resources/prioritized_resource_manager.h" |
20 #include "cc/scheduler/delay_based_time_source.h" | 21 #include "cc/scheduler/delay_based_time_source.h" |
21 #include "cc/scheduler/frame_rate_controller.h" | 22 #include "cc/scheduler/frame_rate_controller.h" |
22 #include "cc/scheduler/scheduler.h" | 23 #include "cc/scheduler/scheduler.h" |
23 #include "cc/trees/blocking_task_runner.h" | 24 #include "cc/trees/blocking_task_runner.h" |
24 #include "cc/trees/layer_tree_host.h" | 25 #include "cc/trees/layer_tree_host.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 layer_tree_host->settings().using_synchronous_renderer_compositor), | 107 layer_tree_host->settings().using_synchronous_renderer_compositor), |
107 inside_draw_(false), | 108 inside_draw_(false), |
108 can_cancel_commit_(true), | 109 can_cancel_commit_(true), |
109 defer_commits_(false), | 110 defer_commits_(false), |
110 input_throttled_until_commit_(false), | 111 input_throttled_until_commit_(false), |
111 renew_tree_priority_on_impl_thread_pending_(false), | 112 renew_tree_priority_on_impl_thread_pending_(false), |
112 draw_duration_history_(kDurationHistorySize), | 113 draw_duration_history_(kDurationHistorySize), |
113 begin_main_frame_to_commit_duration_history_(kDurationHistorySize), | 114 begin_main_frame_to_commit_duration_history_(kDurationHistorySize), |
114 commit_to_activate_duration_history_(kDurationHistorySize), | 115 commit_to_activate_duration_history_(kDurationHistorySize), |
115 weak_factory_on_impl_thread_(this), | 116 weak_factory_on_impl_thread_(this), |
116 weak_factory_(this) { | 117 weak_factory_(this), |
| 118 layer_tree_host_id_(layer_tree_host->id()) { |
117 TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy"); | 119 TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy"); |
118 DCHECK(IsMainThread()); | 120 DCHECK(IsMainThread()); |
119 DCHECK(this->layer_tree_host()); | 121 DCHECK(this->layer_tree_host()); |
120 } | 122 } |
121 | 123 |
122 ThreadProxy::~ThreadProxy() { | 124 ThreadProxy::~ThreadProxy() { |
123 TRACE_EVENT0("cc", "ThreadProxy::~ThreadProxy"); | 125 TRACE_EVENT0("cc", "ThreadProxy::~ThreadProxy"); |
124 DCHECK(IsMainThread()); | 126 DCHECK(IsMainThread()); |
125 DCHECK(!started_); | 127 DCHECK(!started_); |
126 } | 128 } |
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 settings.deadline_scheduling_enabled; | 1401 settings.deadline_scheduling_enabled; |
1400 scheduler_settings.impl_side_painting = settings.impl_side_painting; | 1402 scheduler_settings.impl_side_painting = settings.impl_side_painting; |
1401 scheduler_settings.timeout_and_draw_when_animation_checkerboards = | 1403 scheduler_settings.timeout_and_draw_when_animation_checkerboards = |
1402 settings.timeout_and_draw_when_animation_checkerboards; | 1404 settings.timeout_and_draw_when_animation_checkerboards; |
1403 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = | 1405 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = |
1404 settings.maximum_number_of_failed_draws_before_draw_is_forced_; | 1406 settings.maximum_number_of_failed_draws_before_draw_is_forced_; |
1405 scheduler_settings.using_synchronous_renderer_compositor = | 1407 scheduler_settings.using_synchronous_renderer_compositor = |
1406 settings.using_synchronous_renderer_compositor; | 1408 settings.using_synchronous_renderer_compositor; |
1407 scheduler_settings.throttle_frame_production = | 1409 scheduler_settings.throttle_frame_production = |
1408 settings.throttle_frame_production; | 1410 settings.throttle_frame_production; |
1409 scheduler_on_impl_thread_ = Scheduler::Create(this, scheduler_settings); | 1411 scheduler_on_impl_thread_ = Scheduler::Create(this, scheduler_settings, |
| 1412 layer_tree_host_id_); |
1410 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); | 1413 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); |
1411 | 1414 |
1412 impl_thread_weak_ptr_ = weak_factory_on_impl_thread_.GetWeakPtr(); | 1415 impl_thread_weak_ptr_ = weak_factory_on_impl_thread_.GetWeakPtr(); |
1413 completion->Signal(); | 1416 completion->Signal(); |
1414 } | 1417 } |
1415 | 1418 |
1416 void ThreadProxy::InitializeOutputSurfaceOnImplThread( | 1419 void ThreadProxy::InitializeOutputSurfaceOnImplThread( |
1417 CompletionEvent* completion, | 1420 CompletionEvent* completion, |
1418 scoped_ptr<OutputSurface> output_surface, | 1421 scoped_ptr<OutputSurface> output_surface, |
1419 scoped_refptr<ContextProvider> offscreen_context_provider, | 1422 scoped_refptr<ContextProvider> offscreen_context_provider, |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1649 commit_to_activate_duration_history_.InsertSample( | 1652 commit_to_activate_duration_history_.InsertSample( |
1650 base::TimeTicks::HighResNow() - commit_complete_time_); | 1653 base::TimeTicks::HighResNow() - commit_complete_time_); |
1651 } | 1654 } |
1652 | 1655 |
1653 void ThreadProxy::DidManageTiles() { | 1656 void ThreadProxy::DidManageTiles() { |
1654 DCHECK(IsImplThread()); | 1657 DCHECK(IsImplThread()); |
1655 scheduler_on_impl_thread_->DidManageTiles(); | 1658 scheduler_on_impl_thread_->DidManageTiles(); |
1656 } | 1659 } |
1657 | 1660 |
1658 } // namespace cc | 1661 } // namespace cc |
OLD | NEW |