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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread"); | 427 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread"); |
429 DCHECK(IsImplThread()); | 428 DCHECK(IsImplThread()); |
430 if (!impl().layer_tree_host_impl->IsContextLost()) | 429 if (!impl().layer_tree_host_impl->IsContextLost()) |
431 return; | 430 return; |
432 if (ContextProvider* offscreen_contexts = | 431 if (ContextProvider* offscreen_contexts = |
433 impl().layer_tree_host_impl->offscreen_context_provider()) | 432 impl().layer_tree_host_impl->offscreen_context_provider()) |
434 offscreen_contexts->VerifyContexts(); | 433 offscreen_contexts->VerifyContexts(); |
435 impl().scheduler->DidLoseOutputSurface(); | 434 impl().scheduler->DidLoseOutputSurface(); |
436 } | 435 } |
437 | 436 |
| 437 void ThreadProxy::CommitVSyncParameters(base::TimeTicks timebase, |
| 438 base::TimeDelta interval) { |
| 439 impl().scheduler->CommitVSyncParameters(timebase, interval); |
| 440 } |
| 441 |
| 442 void ThreadProxy::SetEstimatedParentDrawTime(base::TimeDelta draw_time) { |
| 443 impl().scheduler->SetEstimatedParentDrawTime(draw_time); |
| 444 } |
| 445 |
438 void ThreadProxy::SetMaxSwapsPending(int max) { | 446 void ThreadProxy::SetMaxSwapsPending(int max) { |
439 impl().scheduler->SetMaxSwapsPending(max); | 447 impl().scheduler->SetMaxSwapsPending(max); |
440 } | 448 } |
441 | 449 |
442 void ThreadProxy::DidSwapBuffersOnImplThread() { | 450 void ThreadProxy::DidSwapBuffersOnImplThread() { |
443 impl().scheduler->DidSwapBuffers(); | 451 impl().scheduler->DidSwapBuffers(); |
444 } | 452 } |
445 | 453 |
446 void ThreadProxy::OnSwapBuffersCompleteOnImplThread() { | 454 void ThreadProxy::OnSwapBuffersCompleteOnImplThread() { |
447 TRACE_EVENT0("cc", "ThreadProxy::OnSwapBuffersCompleteOnImplThread"); | 455 TRACE_EVENT0("cc", "ThreadProxy::OnSwapBuffersCompleteOnImplThread"); |
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 completion->Signal(); | 1480 completion->Signal(); |
1473 } | 1481 } |
1474 | 1482 |
1475 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { | 1483 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { |
1476 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); | 1484 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); |
1477 DCHECK(IsImplThread()); | 1485 DCHECK(IsImplThread()); |
1478 impl().layer_tree_host_impl = | 1486 impl().layer_tree_host_impl = |
1479 layer_tree_host()->CreateLayerTreeHostImpl(this); | 1487 layer_tree_host()->CreateLayerTreeHostImpl(this); |
1480 const LayerTreeSettings& settings = layer_tree_host()->settings(); | 1488 const LayerTreeSettings& settings = layer_tree_host()->settings(); |
1481 SchedulerSettings scheduler_settings; | 1489 SchedulerSettings scheduler_settings; |
| 1490 scheduler_settings.begin_frame_scheduling_enabled = |
| 1491 settings.begin_frame_scheduling_enabled; |
1482 scheduler_settings.main_frame_before_draw_enabled = | 1492 scheduler_settings.main_frame_before_draw_enabled = |
1483 settings.main_frame_before_draw_enabled; | 1493 settings.main_frame_before_draw_enabled; |
1484 scheduler_settings.main_frame_before_activation_enabled = | 1494 scheduler_settings.main_frame_before_activation_enabled = |
1485 settings.main_frame_before_activation_enabled; | 1495 settings.main_frame_before_activation_enabled; |
1486 scheduler_settings.impl_side_painting = settings.impl_side_painting; | 1496 scheduler_settings.impl_side_painting = settings.impl_side_painting; |
1487 scheduler_settings.timeout_and_draw_when_animation_checkerboards = | 1497 scheduler_settings.timeout_and_draw_when_animation_checkerboards = |
1488 settings.timeout_and_draw_when_animation_checkerboards; | 1498 settings.timeout_and_draw_when_animation_checkerboards; |
1489 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = | 1499 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = |
1490 settings.maximum_number_of_failed_draws_before_draw_is_forced_; | 1500 settings.maximum_number_of_failed_draws_before_draw_is_forced_; |
1491 scheduler_settings.using_synchronous_renderer_compositor = | 1501 scheduler_settings.using_synchronous_renderer_compositor = |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1749 | 1759 |
1750 impl().timing_history.DidActivatePendingTree(); | 1760 impl().timing_history.DidActivatePendingTree(); |
1751 } | 1761 } |
1752 | 1762 |
1753 void ThreadProxy::DidManageTiles() { | 1763 void ThreadProxy::DidManageTiles() { |
1754 DCHECK(IsImplThread()); | 1764 DCHECK(IsImplThread()); |
1755 impl().scheduler->DidManageTiles(); | 1765 impl().scheduler->DidManageTiles(); |
1756 } | 1766 } |
1757 | 1767 |
1758 } // namespace cc | 1768 } // namespace cc |
OLD | NEW |