| 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 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1247       kCommitAndActivationDurationEstimationPercentile); |  1248       kCommitAndActivationDurationEstimationPercentile); | 
|  1248 } |  1249 } | 
|  1249  |  1250  | 
|  1250 base::TimeDelta ThreadProxy::CommitToActivateDurationEstimate() { |  1251 base::TimeDelta ThreadProxy::CommitToActivateDurationEstimate() { | 
|  1251   return commit_to_activate_duration_history_.Percentile( |  1252   return commit_to_activate_duration_history_.Percentile( | 
|  1252       kCommitAndActivationDurationEstimationPercentile); |  1253       kCommitAndActivationDurationEstimationPercentile); | 
|  1253 } |  1254 } | 
|  1254  |  1255  | 
|  1255 void ThreadProxy::PostBeginImplFrameDeadline(const base::Closure& closure, |  1256 void ThreadProxy::PostBeginImplFrameDeadline(const base::Closure& closure, | 
|  1256                                              base::TimeTicks deadline) { |  1257                                              base::TimeTicks deadline) { | 
|  1257   base::TimeDelta delta = deadline - base::TimeTicks::Now(); |  1258   base::TimeDelta delta = deadline - gfx::FrameTime::Now(); | 
|  1258   if (delta <= base::TimeDelta()) |  1259   if (delta <= base::TimeDelta()) | 
|  1259     delta = base::TimeDelta(); |  1260     delta = base::TimeDelta(); | 
|  1260   Proxy::ImplThreadTaskRunner()->PostDelayedTask(FROM_HERE, closure, delta); |  1261   Proxy::ImplThreadTaskRunner()->PostDelayedTask(FROM_HERE, closure, delta); | 
|  1261 } |  1262 } | 
|  1262  |  1263  | 
|  1263 void ThreadProxy::DidBeginImplFrameDeadline() { |  1264 void ThreadProxy::DidBeginImplFrameDeadline() { | 
|  1264   layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame(); |  1265   layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame(); | 
|  1265 } |  1266 } | 
|  1266  |  1267  | 
|  1267 void ThreadProxy::ReadyToFinalizeTextureUpdates() { |  1268 void ThreadProxy::ReadyToFinalizeTextureUpdates() { | 
| (...skipping 313 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 |