| 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 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 kCommitAndActivationDurationEstimationPercentile); | 1252 kCommitAndActivationDurationEstimationPercentile); |
| 1252 } | 1253 } |
| 1253 | 1254 |
| 1254 base::TimeDelta ThreadProxy::CommitToActivateDurationEstimate() { | 1255 base::TimeDelta ThreadProxy::CommitToActivateDurationEstimate() { |
| 1255 return commit_to_activate_duration_history_.Percentile( | 1256 return commit_to_activate_duration_history_.Percentile( |
| 1256 kCommitAndActivationDurationEstimationPercentile); | 1257 kCommitAndActivationDurationEstimationPercentile); |
| 1257 } | 1258 } |
| 1258 | 1259 |
| 1259 void ThreadProxy::PostBeginFrameDeadline(const base::Closure& closure, | 1260 void ThreadProxy::PostBeginFrameDeadline(const base::Closure& closure, |
| 1260 base::TimeTicks deadline) { | 1261 base::TimeTicks deadline) { |
| 1261 base::TimeDelta delta = deadline - base::TimeTicks::Now(); | 1262 base::TimeDelta delta = deadline - gfx::FrameTime::Now(); |
| 1262 if (delta <= base::TimeDelta()) | 1263 if (delta <= base::TimeDelta()) |
| 1263 delta = base::TimeDelta(); | 1264 delta = base::TimeDelta(); |
| 1264 Proxy::ImplThreadTaskRunner()->PostDelayedTask(FROM_HERE, closure, delta); | 1265 Proxy::ImplThreadTaskRunner()->PostDelayedTask(FROM_HERE, closure, delta); |
| 1265 } | 1266 } |
| 1266 | 1267 |
| 1267 void ThreadProxy::ReadyToFinalizeTextureUpdates() { | 1268 void ThreadProxy::ReadyToFinalizeTextureUpdates() { |
| 1268 DCHECK(IsImplThread()); | 1269 DCHECK(IsImplThread()); |
| 1269 scheduler_on_impl_thread_->FinishCommit(); | 1270 scheduler_on_impl_thread_->FinishCommit(); |
| 1270 } | 1271 } |
| 1271 | 1272 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1581 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1582 completion_event_for_commit_held_on_tree_activation_ = NULL; |
| 1582 } | 1583 } |
| 1583 | 1584 |
| 1584 UpdateBackgroundAnimateTicking(); | 1585 UpdateBackgroundAnimateTicking(); |
| 1585 | 1586 |
| 1586 commit_to_activate_duration_history_.InsertSample( | 1587 commit_to_activate_duration_history_.InsertSample( |
| 1587 base::TimeTicks::HighResNow() - commit_complete_time_); | 1588 base::TimeTicks::HighResNow() - commit_complete_time_); |
| 1588 } | 1589 } |
| 1589 | 1590 |
| 1590 } // namespace cc | 1591 } // namespace cc |
| OLD | NEW |