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_synthetic_delay.h" | 13 #include "base/debug/trace_event_synthetic_delay.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.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/input/input_handler.h" | 18 #include "cc/input/input_handler.h" |
19 #include "cc/output/context_provider.h" | 19 #include "cc/output/context_provider.h" |
20 #include "cc/output/output_surface.h" | 20 #include "cc/output/output_surface.h" |
21 #include "cc/quads/draw_quad.h" | 21 #include "cc/quads/draw_quad.h" |
22 #include "cc/resources/prioritized_resource_manager.h" | 22 #include "cc/resources/prioritized_resource_manager.h" |
23 #include "cc/scheduler/delay_based_time_source.h" | 23 #include "cc/scheduler/delay_based_time_source.h" |
24 #include "cc/scheduler/frame_rate_controller.h" | |
25 #include "cc/scheduler/scheduler.h" | 24 #include "cc/scheduler/scheduler.h" |
26 #include "cc/trees/blocking_task_runner.h" | 25 #include "cc/trees/blocking_task_runner.h" |
27 #include "cc/trees/layer_tree_host.h" | 26 #include "cc/trees/layer_tree_host.h" |
28 #include "cc/trees/layer_tree_impl.h" | 27 #include "cc/trees/layer_tree_impl.h" |
29 #include "ui/gfx/frame_time.h" | 28 #include "ui/gfx/frame_time.h" |
30 | 29 |
31 namespace { | 30 namespace { |
32 | 31 |
33 // Measured in seconds. | 32 // Measured in seconds. |
34 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; | 33 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread"); | 425 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread"); |
427 DCHECK(IsImplThread()); | 426 DCHECK(IsImplThread()); |
428 if (!impl().layer_tree_host_impl->IsContextLost()) | 427 if (!impl().layer_tree_host_impl->IsContextLost()) |
429 return; | 428 return; |
430 if (ContextProvider* offscreen_contexts = | 429 if (ContextProvider* offscreen_contexts = |
431 impl().layer_tree_host_impl->offscreen_context_provider()) | 430 impl().layer_tree_host_impl->offscreen_context_provider()) |
432 offscreen_contexts->VerifyContexts(); | 431 offscreen_contexts->VerifyContexts(); |
433 impl().scheduler->DidLoseOutputSurface(); | 432 impl().scheduler->DidLoseOutputSurface(); |
434 } | 433 } |
435 | 434 |
| 435 void ThreadProxy::CommitVSyncParameters(base::TimeTicks timebase, |
| 436 base::TimeDelta interval) { |
| 437 impl().scheduler->CommitVSyncParameters(timebase, interval); |
| 438 } |
| 439 |
| 440 void ThreadProxy::SetEstimatedParentDrawTime(base::TimeDelta draw_time) { |
| 441 impl().scheduler->SetEstimatedParentDrawTime(draw_time); |
| 442 } |
| 443 |
436 void ThreadProxy::SetMaxSwapsPendingOnImplThread(int max) { | 444 void ThreadProxy::SetMaxSwapsPendingOnImplThread(int max) { |
437 impl().scheduler->SetMaxSwapsPending(max); | 445 impl().scheduler->SetMaxSwapsPending(max); |
438 } | 446 } |
439 | 447 |
440 void ThreadProxy::DidSwapBuffersOnImplThread() { | 448 void ThreadProxy::DidSwapBuffersOnImplThread() { |
441 impl().scheduler->DidSwapBuffers(); | 449 impl().scheduler->DidSwapBuffers(); |
442 } | 450 } |
443 | 451 |
444 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() { | 452 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() { |
445 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); | 453 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); |
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 completion->Signal(); | 1427 completion->Signal(); |
1420 } | 1428 } |
1421 | 1429 |
1422 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { | 1430 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { |
1423 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); | 1431 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); |
1424 DCHECK(IsImplThread()); | 1432 DCHECK(IsImplThread()); |
1425 impl().layer_tree_host_impl = | 1433 impl().layer_tree_host_impl = |
1426 layer_tree_host()->CreateLayerTreeHostImpl(this); | 1434 layer_tree_host()->CreateLayerTreeHostImpl(this); |
1427 const LayerTreeSettings& settings = layer_tree_host()->settings(); | 1435 const LayerTreeSettings& settings = layer_tree_host()->settings(); |
1428 SchedulerSettings scheduler_settings; | 1436 SchedulerSettings scheduler_settings; |
| 1437 scheduler_settings.begin_frame_scheduling_enabled = |
| 1438 settings.begin_frame_scheduling_enabled; |
1429 scheduler_settings.main_frame_before_draw_enabled = | 1439 scheduler_settings.main_frame_before_draw_enabled = |
1430 settings.main_frame_before_draw_enabled; | 1440 settings.main_frame_before_draw_enabled; |
1431 scheduler_settings.main_frame_before_activation_enabled = | 1441 scheduler_settings.main_frame_before_activation_enabled = |
1432 settings.main_frame_before_activation_enabled; | 1442 settings.main_frame_before_activation_enabled; |
1433 scheduler_settings.impl_side_painting = settings.impl_side_painting; | 1443 scheduler_settings.impl_side_painting = settings.impl_side_painting; |
1434 scheduler_settings.timeout_and_draw_when_animation_checkerboards = | 1444 scheduler_settings.timeout_and_draw_when_animation_checkerboards = |
1435 settings.timeout_and_draw_when_animation_checkerboards; | 1445 settings.timeout_and_draw_when_animation_checkerboards; |
1436 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = | 1446 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = |
1437 settings.maximum_number_of_failed_draws_before_draw_is_forced_; | 1447 settings.maximum_number_of_failed_draws_before_draw_is_forced_; |
1438 scheduler_settings.using_synchronous_renderer_compositor = | 1448 scheduler_settings.using_synchronous_renderer_compositor = |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 | 1706 |
1697 impl().timing_history.DidActivatePendingTree(); | 1707 impl().timing_history.DidActivatePendingTree(); |
1698 } | 1708 } |
1699 | 1709 |
1700 void ThreadProxy::DidManageTiles() { | 1710 void ThreadProxy::DidManageTiles() { |
1701 DCHECK(IsImplThread()); | 1711 DCHECK(IsImplThread()); |
1702 impl().scheduler->DidManageTiles(); | 1712 impl().scheduler->DidManageTiles(); |
1703 } | 1713 } |
1704 | 1714 |
1705 } // namespace cc | 1715 } // namespace cc |
OLD | NEW |