| 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/debug/benchmark_instrumentation.h" | 13 #include "cc/debug/benchmark_instrumentation.h" |
| 14 #include "cc/input/input_handler.h" | 14 #include "cc/input/input_handler.h" |
| 15 #include "cc/output/context_provider.h" | 15 #include "cc/output/context_provider.h" |
| 16 #include "cc/output/output_surface.h" | 16 #include "cc/output/output_surface.h" |
| 17 #include "cc/quads/draw_quad.h" | 17 #include "cc/quads/draw_quad.h" |
| 18 #include "cc/resources/prioritized_resource_manager.h" | 18 #include "cc/resources/prioritized_resource_manager.h" |
| 19 #include "cc/scheduler/delay_based_time_source.h" | 19 #include "cc/scheduler/delay_based_time_source.h" |
| 20 #include "cc/scheduler/frame_rate_controller.h" | 20 #include "cc/scheduler/frame_rate_controller.h" |
| 21 #include "cc/scheduler/scheduler.h" | 21 #include "cc/scheduler/scheduler.h" |
| 22 #include "cc/trees/blocking_task_runner.h" | 22 #include "cc/trees/blocking_task_runner.h" |
| 23 #include "cc/trees/layer_tree_host.h" | 23 #include "cc/trees/layer_tree_host.h" |
| 24 #include "cc/trees/layer_tree_impl.h" | 24 #include "cc/trees/layer_tree_impl.h" |
| 25 #include "ui/gfx/frame_time.h" |
| 25 | 26 |
| 26 // Measured in seconds. | 27 // Measured in seconds. |
| 27 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; | 28 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; |
| 28 | 29 |
| 29 const size_t kDurationHistorySize = 60; | 30 const size_t kDurationHistorySize = 60; |
| 30 const double kCommitAndActivationDurationEstimationPercentile = 50.0; | 31 const double kCommitAndActivationDurationEstimationPercentile = 50.0; |
| 31 const double kDrawDurationEstimationPercentile = 100.0; | 32 const double kDrawDurationEstimationPercentile = 100.0; |
| 32 const int kDrawDurationEstimatePaddingInMicroseconds = 0; | 33 const int kDrawDurationEstimatePaddingInMicroseconds = 0; |
| 33 | 34 |
| 34 namespace cc { | 35 namespace cc { |
| (...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 kCommitAndActivationDurationEstimationPercentile); | 1249 kCommitAndActivationDurationEstimationPercentile); |
| 1249 } | 1250 } |
| 1250 | 1251 |
| 1251 base::TimeDelta ThreadProxy::CommitToActivateDurationEstimate() { | 1252 base::TimeDelta ThreadProxy::CommitToActivateDurationEstimate() { |
| 1252 return commit_to_activate_duration_history_.Percentile( | 1253 return commit_to_activate_duration_history_.Percentile( |
| 1253 kCommitAndActivationDurationEstimationPercentile); | 1254 kCommitAndActivationDurationEstimationPercentile); |
| 1254 } | 1255 } |
| 1255 | 1256 |
| 1256 void ThreadProxy::PostBeginImplFrameDeadline(const base::Closure& closure, | 1257 void ThreadProxy::PostBeginImplFrameDeadline(const base::Closure& closure, |
| 1257 base::TimeTicks deadline) { | 1258 base::TimeTicks deadline) { |
| 1258 base::TimeDelta delta = deadline - base::TimeTicks::Now(); | 1259 base::TimeDelta delta = deadline - gfx::FrameTime::Now(); |
| 1259 if (delta <= base::TimeDelta()) | 1260 if (delta <= base::TimeDelta()) |
| 1260 delta = base::TimeDelta(); | 1261 delta = base::TimeDelta(); |
| 1261 Proxy::ImplThreadTaskRunner()->PostDelayedTask(FROM_HERE, closure, delta); | 1262 Proxy::ImplThreadTaskRunner()->PostDelayedTask(FROM_HERE, closure, delta); |
| 1262 } | 1263 } |
| 1263 | 1264 |
| 1264 void ThreadProxy::DidBeginImplFrameDeadline() { | 1265 void ThreadProxy::DidBeginImplFrameDeadline() { |
| 1265 layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame(); | 1266 layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame(); |
| 1266 } | 1267 } |
| 1267 | 1268 |
| 1268 void ThreadProxy::ReadyToFinalizeTextureUpdates() { | 1269 void ThreadProxy::ReadyToFinalizeTextureUpdates() { |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1584 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1585 completion_event_for_commit_held_on_tree_activation_ = NULL; |
| 1585 } | 1586 } |
| 1586 | 1587 |
| 1587 UpdateBackgroundAnimateTicking(); | 1588 UpdateBackgroundAnimateTicking(); |
| 1588 | 1589 |
| 1589 commit_to_activate_duration_history_.InsertSample( | 1590 commit_to_activate_duration_history_.InsertSample( |
| 1590 base::TimeTicks::HighResNow() - commit_complete_time_); | 1591 base::TimeTicks::HighResNow() - commit_complete_time_); |
| 1591 } | 1592 } |
| 1592 | 1593 |
| 1593 } // namespace cc | 1594 } // namespace cc |
| OLD | NEW |