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

Side by Side Diff: cc/scheduler/begin_frame_tracker.cc

Issue 2828873006: Revert of Revert "cc: Make scheduler run incoming frame after previous deadline." (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « cc/scheduler/begin_frame_tracker.h ('k') | cc/scheduler/scheduler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/scheduler/begin_frame_tracker.h" 5 #include "cc/scheduler/begin_frame_tracker.h"
6 6
7 namespace cc { 7 namespace cc {
8 8
9 BeginFrameTracker::BeginFrameTracker(const tracked_objects::Location& location) 9 BeginFrameTracker::BeginFrameTracker(const tracked_objects::Location& location)
10 : location_(location), 10 : location_(location),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 base::TimeDelta interval = current_args_.interval; 71 base::TimeDelta interval = current_args_.interval;
72 // Normal interval will be ~16ms, 200Hz (5ms) screens are the fastest 72 // Normal interval will be ~16ms, 200Hz (5ms) screens are the fastest
73 // easily available so anything less than that is likely an error. 73 // easily available so anything less than that is likely an error.
74 if (interval < base::TimeDelta::FromMilliseconds(1)) { 74 if (interval < base::TimeDelta::FromMilliseconds(1)) {
75 interval = BeginFrameArgs::DefaultInterval(); 75 interval = BeginFrameArgs::DefaultInterval();
76 } 76 }
77 return interval; 77 return interval;
78 } 78 }
79 79
80 void BeginFrameTracker::AsValueInto( 80 void BeginFrameTracker::AsValueInto(
81 base::TimeTicks now,
82 base::trace_event::TracedValue* state) const { 81 base::trace_event::TracedValue* state) const {
83 state->SetDouble("updated_at_ms", 82 state->SetDouble("updated_at_ms",
84 (current_updated_at_ - base::TimeTicks()).InMillisecondsF()); 83 (current_updated_at_ - base::TimeTicks()).InMillisecondsF());
85 state->SetDouble( 84 state->SetDouble(
86 "finished_at_ms", 85 "finished_at_ms",
87 (current_finished_at_ - base::TimeTicks()).InMillisecondsF()); 86 (current_finished_at_ - base::TimeTicks()).InMillisecondsF());
88 if (HasFinished()) { 87 if (HasFinished()) {
89 state->SetString("state", "FINISHED"); 88 state->SetString("state", "FINISHED");
90 state->BeginDictionary("current_args_"); 89 state->BeginDictionary("current_args_");
91 } else { 90 } else {
92 state->SetString("state", "USING"); 91 state->SetString("state", "USING");
93 state->BeginDictionary("last_args_"); 92 state->BeginDictionary("last_args_");
94 } 93 }
95 current_args_.AsValueInto(state); 94 current_args_.AsValueInto(state);
96 state->EndDictionary(); 95 state->EndDictionary();
97 96
97 base::TimeTicks now = base::TimeTicks::Now();
98 base::TimeTicks frame_time = current_args_.frame_time; 98 base::TimeTicks frame_time = current_args_.frame_time;
99 base::TimeTicks deadline = current_args_.deadline; 99 base::TimeTicks deadline = current_args_.deadline;
100 base::TimeDelta interval = current_args_.interval; 100 base::TimeDelta interval = current_args_.interval;
101 state->BeginDictionary("major_timestamps_in_ms"); 101 state->BeginDictionary("major_timestamps_in_ms");
102 state->SetDouble("0_interval", interval.InMillisecondsF()); 102 state->SetDouble("0_interval", interval.InMillisecondsF());
103 state->SetDouble("1_now_to_deadline", (deadline - now).InMillisecondsF()); 103 state->SetDouble("1_now_to_deadline", (deadline - now).InMillisecondsF());
104 state->SetDouble("2_frame_time_to_now", (now - frame_time).InMillisecondsF()); 104 state->SetDouble("2_frame_time_to_now", (now - frame_time).InMillisecondsF());
105 state->SetDouble("3_frame_time_to_deadline", 105 state->SetDouble("3_frame_time_to_deadline",
106 (deadline - frame_time).InMillisecondsF()); 106 (deadline - frame_time).InMillisecondsF());
107 state->SetDouble("4_now", (now - base::TimeTicks()).InMillisecondsF()); 107 state->SetDouble("4_now", (now - base::TimeTicks()).InMillisecondsF());
108 state->SetDouble("5_frame_time", 108 state->SetDouble("5_frame_time",
109 (frame_time - base::TimeTicks()).InMillisecondsF()); 109 (frame_time - base::TimeTicks()).InMillisecondsF());
110 state->SetDouble("6_deadline", 110 state->SetDouble("6_deadline",
111 (deadline - base::TimeTicks()).InMillisecondsF()); 111 (deadline - base::TimeTicks()).InMillisecondsF());
112 state->EndDictionary(); 112 state->EndDictionary();
113 } 113 }
114 114
115 const BeginFrameArgs& BeginFrameTracker::DangerousMethodCurrentOrLast() const { 115 const BeginFrameArgs& BeginFrameTracker::DangerousMethodCurrentOrLast() const {
116 if (!HasFinished()) { 116 if (!HasFinished()) {
117 return Current(); 117 return Current();
118 } else { 118 } else {
119 return Last(); 119 return Last();
120 } 120 }
121 } 121 }
122 122
123 } // namespace cc 123 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/begin_frame_tracker.h ('k') | cc/scheduler/scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698