Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(924)

Unified Diff: cc/trees/thread_proxy.cc

Issue 154163005: cc: Abstract out proxy timing history (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile oops Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/thread_proxy.cc
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index a757a82bae40db9b42012094aab6469165b8289b..860144b6151adc3f4adf99f2c3212f164f516cd9 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -32,11 +32,6 @@ namespace {
// Measured in seconds.
const double kSmoothnessTakesPriorityExpirationDelay = 0.25;
-const size_t kDurationHistorySize = 60;
-const double kCommitAndActivationDurationEstimationPercentile = 50.0;
-const double kDrawDurationEstimationPercentile = 100.0;
-const int kDrawDurationEstimatePaddingInMicroseconds = 0;
-
class SwapPromiseChecker {
public:
explicit SwapPromiseChecker(cc::LayerTreeHost* layer_tree_host)
@@ -132,9 +127,6 @@ ThreadProxy::CompositorThreadOnly::CompositorThreadOnly(ThreadProxy* proxy)
input_throttled_until_commit(false),
animations_frozen_until_next_draw(false),
renew_tree_priority_pending(false),
- draw_duration_history(kDurationHistorySize),
- begin_main_frame_to_commit_duration_history(kDurationHistorySize),
- commit_to_activate_duration_history(kDurationHistorySize),
weak_factory(proxy) {}
ThreadProxy::CompositorThreadOnly::~CompositorThreadOnly() {}
@@ -787,7 +779,7 @@ void ThreadProxy::ScheduledActionSendBeginMainFrame() {
impl().begin_main_frame_sent_completion_event->Signal();
impl().begin_main_frame_sent_completion_event = NULL;
}
- impl().begin_main_frame_sent_time = base::TimeTicks::HighResNow();
+ impl().timing_history.DidBeginMainFrame();
}
void ThreadProxy::BeginMainFrame(
@@ -1093,9 +1085,7 @@ void ThreadProxy::ScheduledActionCommit() {
impl().next_frame_is_newly_committed_frame = true;
- impl().commit_complete_time = base::TimeTicks::HighResNow();
- impl().begin_main_frame_to_commit_duration_history.InsertSample(
- impl().commit_complete_time - impl().begin_main_frame_sent_time);
+ impl().timing_history.DidCommit();
// SetVisible kicks off the next scheduler action, so this must be last.
impl().scheduler->SetVisible(impl().layer_tree_host_impl->visible());
@@ -1132,7 +1122,7 @@ DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal(
DCHECK(IsImplThread());
DCHECK(impl().layer_tree_host_impl.get());
- base::TimeTicks start_time = base::TimeTicks::HighResNow();
+ impl().timing_history.DidStartDrawing();
base::TimeDelta draw_duration_estimate = DrawDurationEstimate();
base::AutoReset<bool> mark_inside(&impl().inside_draw, true);
@@ -1242,8 +1232,8 @@ DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal(
if (draw_frame) {
CheckOutputSurfaceStatusOnImplThread();
- base::TimeDelta draw_duration = base::TimeTicks::HighResNow() - start_time;
- impl().draw_duration_history.InsertSample(draw_duration);
+ base::TimeDelta draw_duration = impl().timing_history.DidFinishDrawing();
+
base::TimeDelta draw_duration_overestimate;
base::TimeDelta draw_duration_underestimate;
if (draw_duration > draw_duration_estimate)
@@ -1350,21 +1340,15 @@ void ThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) {
}
base::TimeDelta ThreadProxy::DrawDurationEstimate() {
- base::TimeDelta historical_estimate = impl().draw_duration_history.Percentile(
- kDrawDurationEstimationPercentile);
- base::TimeDelta padding = base::TimeDelta::FromMicroseconds(
- kDrawDurationEstimatePaddingInMicroseconds);
- return historical_estimate + padding;
+ return impl().timing_history.DrawDurationEstimate();
}
base::TimeDelta ThreadProxy::BeginMainFrameToCommitDurationEstimate() {
- return impl().begin_main_frame_to_commit_duration_history.Percentile(
- kCommitAndActivationDurationEstimationPercentile);
+ return impl().timing_history.BeginMainFrameToCommitDurationEstimate();
}
base::TimeDelta ThreadProxy::CommitToActivateDurationEstimate() {
- return impl().commit_to_activate_duration_history.Percentile(
- kCommitAndActivationDurationEstimationPercentile);
+ return impl().timing_history.CommitToActivateDurationEstimate();
}
void ThreadProxy::PostBeginImplFrameDeadline(const base::Closure& closure,
@@ -1709,8 +1693,7 @@ void ThreadProxy::DidActivatePendingTree() {
UpdateBackgroundAnimateTicking();
- impl().commit_to_activate_duration_history.InsertSample(
- base::TimeTicks::HighResNow() - impl().commit_complete_time);
+ impl().timing_history.DidActivatePendingTree();
}
void ThreadProxy::DidManageTiles() {
« no previous file with comments | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698