| 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::SetMaxSwapsPending(int max) { | 444 void ThreadProxy::SetMaxSwapsPending(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 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1422 completion->Signal(); | 1430 completion->Signal(); |
| 1423 } | 1431 } |
| 1424 | 1432 |
| 1425 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { | 1433 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { |
| 1426 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); | 1434 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); |
| 1427 DCHECK(IsImplThread()); | 1435 DCHECK(IsImplThread()); |
| 1428 impl().layer_tree_host_impl = | 1436 impl().layer_tree_host_impl = |
| 1429 layer_tree_host()->CreateLayerTreeHostImpl(this); | 1437 layer_tree_host()->CreateLayerTreeHostImpl(this); |
| 1430 const LayerTreeSettings& settings = layer_tree_host()->settings(); | 1438 const LayerTreeSettings& settings = layer_tree_host()->settings(); |
| 1431 SchedulerSettings scheduler_settings; | 1439 SchedulerSettings scheduler_settings; |
| 1440 scheduler_settings.begin_frame_scheduling_enabled = |
| 1441 settings.begin_frame_scheduling_enabled; |
| 1432 scheduler_settings.main_frame_before_draw_enabled = | 1442 scheduler_settings.main_frame_before_draw_enabled = |
| 1433 settings.main_frame_before_draw_enabled; | 1443 settings.main_frame_before_draw_enabled; |
| 1434 scheduler_settings.main_frame_before_activation_enabled = | 1444 scheduler_settings.main_frame_before_activation_enabled = |
| 1435 settings.main_frame_before_activation_enabled; | 1445 settings.main_frame_before_activation_enabled; |
| 1436 scheduler_settings.impl_side_painting = settings.impl_side_painting; | 1446 scheduler_settings.impl_side_painting = settings.impl_side_painting; |
| 1437 scheduler_settings.timeout_and_draw_when_animation_checkerboards = | 1447 scheduler_settings.timeout_and_draw_when_animation_checkerboards = |
| 1438 settings.timeout_and_draw_when_animation_checkerboards; | 1448 settings.timeout_and_draw_when_animation_checkerboards; |
| 1439 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = | 1449 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = |
| 1440 settings.maximum_number_of_failed_draws_before_draw_is_forced_; | 1450 settings.maximum_number_of_failed_draws_before_draw_is_forced_; |
| 1441 scheduler_settings.using_synchronous_renderer_compositor = | 1451 scheduler_settings.using_synchronous_renderer_compositor = |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1699 | 1709 |
| 1700 impl().timing_history.DidActivatePendingTree(); | 1710 impl().timing_history.DidActivatePendingTree(); |
| 1701 } | 1711 } |
| 1702 | 1712 |
| 1703 void ThreadProxy::DidManageTiles() { | 1713 void ThreadProxy::DidManageTiles() { |
| 1704 DCHECK(IsImplThread()); | 1714 DCHECK(IsImplThread()); |
| 1705 impl().scheduler->DidManageTiles(); | 1715 impl().scheduler->DidManageTiles(); |
| 1706 } | 1716 } |
| 1707 | 1717 |
| 1708 } // namespace cc | 1718 } // namespace cc |
| OLD | NEW |