| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 } | 409 } |
| 411 | 410 |
| 412 void ThreadProxy::CheckOutputSurfaceStatusOnImplThread() { | 411 void ThreadProxy::CheckOutputSurfaceStatusOnImplThread() { |
| 413 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread"); | 412 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread"); |
| 414 DCHECK(IsImplThread()); | 413 DCHECK(IsImplThread()); |
| 415 if (!impl().layer_tree_host_impl->IsContextLost()) | 414 if (!impl().layer_tree_host_impl->IsContextLost()) |
| 416 return; | 415 return; |
| 417 impl().scheduler->DidLoseOutputSurface(); | 416 impl().scheduler->DidLoseOutputSurface(); |
| 418 } | 417 } |
| 419 | 418 |
| 419 void ThreadProxy::CommitVSyncParameters(base::TimeTicks timebase, |
| 420 base::TimeDelta interval) { |
| 421 impl().scheduler->CommitVSyncParameters(timebase, interval); |
| 422 } |
| 423 |
| 424 void ThreadProxy::SetEstimatedParentDrawTime(base::TimeDelta draw_time) { |
| 425 impl().scheduler->SetEstimatedParentDrawTime(draw_time); |
| 426 } |
| 427 |
| 420 void ThreadProxy::SetMaxSwapsPendingOnImplThread(int max) { | 428 void ThreadProxy::SetMaxSwapsPendingOnImplThread(int max) { |
| 421 impl().scheduler->SetMaxSwapsPending(max); | 429 impl().scheduler->SetMaxSwapsPending(max); |
| 422 } | 430 } |
| 423 | 431 |
| 424 void ThreadProxy::DidSwapBuffersOnImplThread() { | 432 void ThreadProxy::DidSwapBuffersOnImplThread() { |
| 425 impl().scheduler->DidSwapBuffers(); | 433 impl().scheduler->DidSwapBuffers(); |
| 426 } | 434 } |
| 427 | 435 |
| 428 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() { | 436 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() { |
| 429 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); | 437 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1386 completion->Signal(); | 1394 completion->Signal(); |
| 1387 } | 1395 } |
| 1388 | 1396 |
| 1389 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { | 1397 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { |
| 1390 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); | 1398 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); |
| 1391 DCHECK(IsImplThread()); | 1399 DCHECK(IsImplThread()); |
| 1392 impl().layer_tree_host_impl = | 1400 impl().layer_tree_host_impl = |
| 1393 layer_tree_host()->CreateLayerTreeHostImpl(this); | 1401 layer_tree_host()->CreateLayerTreeHostImpl(this); |
| 1394 const LayerTreeSettings& settings = layer_tree_host()->settings(); | 1402 const LayerTreeSettings& settings = layer_tree_host()->settings(); |
| 1395 SchedulerSettings scheduler_settings; | 1403 SchedulerSettings scheduler_settings; |
| 1404 scheduler_settings.begin_frame_scheduling_enabled = |
| 1405 settings.begin_frame_scheduling_enabled; |
| 1396 scheduler_settings.main_frame_before_draw_enabled = | 1406 scheduler_settings.main_frame_before_draw_enabled = |
| 1397 settings.main_frame_before_draw_enabled; | 1407 settings.main_frame_before_draw_enabled; |
| 1398 scheduler_settings.main_frame_before_activation_enabled = | 1408 scheduler_settings.main_frame_before_activation_enabled = |
| 1399 settings.main_frame_before_activation_enabled; | 1409 settings.main_frame_before_activation_enabled; |
| 1400 scheduler_settings.impl_side_painting = settings.impl_side_painting; | 1410 scheduler_settings.impl_side_painting = settings.impl_side_painting; |
| 1401 scheduler_settings.timeout_and_draw_when_animation_checkerboards = | 1411 scheduler_settings.timeout_and_draw_when_animation_checkerboards = |
| 1402 settings.timeout_and_draw_when_animation_checkerboards; | 1412 settings.timeout_and_draw_when_animation_checkerboards; |
| 1403 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = | 1413 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = |
| 1404 settings.maximum_number_of_failed_draws_before_draw_is_forced_; | 1414 settings.maximum_number_of_failed_draws_before_draw_is_forced_; |
| 1405 scheduler_settings.using_synchronous_renderer_compositor = | 1415 scheduler_settings.using_synchronous_renderer_compositor = |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 | 1665 |
| 1656 impl().timing_history.DidActivatePendingTree(); | 1666 impl().timing_history.DidActivatePendingTree(); |
| 1657 } | 1667 } |
| 1658 | 1668 |
| 1659 void ThreadProxy::DidManageTiles() { | 1669 void ThreadProxy::DidManageTiles() { |
| 1660 DCHECK(IsImplThread()); | 1670 DCHECK(IsImplThread()); |
| 1661 impl().scheduler->DidManageTiles(); | 1671 impl().scheduler->DidManageTiles(); |
| 1662 } | 1672 } |
| 1663 | 1673 |
| 1664 } // namespace cc | 1674 } // namespace cc |
| OLD | NEW |