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

Unified Diff: cc/output/begin_frame_args.cc

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/output/begin_frame_args.h ('k') | cc/output/begin_frame_args_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/begin_frame_args.cc
diff --git a/cc/output/begin_frame_args.cc b/cc/output/begin_frame_args.cc
index fc7098f4798cb1aefbf763f583da487f0fb5572f..0be93180f8783aa699fa618e19a2ddc1374a7c47 100644
--- a/cc/output/begin_frame_args.cc
+++ b/cc/output/begin_frame_args.cc
@@ -9,6 +9,21 @@
namespace cc {
+const char* BeginFrameArgs::TypeToString(BeginFrameArgsType type) {
+ switch (type) {
+ case BeginFrameArgs::INVALID:
+ return "INVALID";
+ case BeginFrameArgs::NORMAL:
+ return "NORMAL";
+ case BeginFrameArgs::SYNCHRONOUS:
+ return "SYNCHRONOUS";
+ case BeginFrameArgs::MISSED:
+ return "MISSED";
+ }
+ NOTREACHED();
+ return "???";
+}
+
BeginFrameArgs::BeginFrameArgs()
: frame_time(base::TimeTicks()),
deadline(base::TimeTicks()),
@@ -26,19 +41,12 @@ BeginFrameArgs::BeginFrameArgs(base::TimeTicks frame_time,
type(type) {
}
-BeginFrameArgs BeginFrameArgs::CreateTyped(
- base::TimeTicks frame_time,
- base::TimeTicks deadline,
- base::TimeDelta interval,
- BeginFrameArgs::BeginFrameArgsType type) {
- DCHECK_NE(type, BeginFrameArgs::INVALID);
- return BeginFrameArgs(frame_time, deadline, interval, type);
-}
-
BeginFrameArgs BeginFrameArgs::Create(base::TimeTicks frame_time,
base::TimeTicks deadline,
- base::TimeDelta interval) {
- return CreateTyped(frame_time, deadline, interval, BeginFrameArgs::NORMAL);
+ base::TimeDelta interval,
+ BeginFrameArgs::BeginFrameArgsType type) {
+ DCHECK_NE(type, BeginFrameArgs::INVALID);
+ return BeginFrameArgs(frame_time, deadline, interval, type);
}
scoped_refptr<base::debug::ConvertableToTraceFormat> BeginFrameArgs::AsValue()
@@ -51,35 +59,12 @@ scoped_refptr<base::debug::ConvertableToTraceFormat> BeginFrameArgs::AsValue()
void BeginFrameArgs::AsValueInto(base::debug::TracedValue* state) const {
state->SetString("type", "BeginFrameArgs");
- switch (type) {
- case BeginFrameArgs::INVALID:
- state->SetString("subtype", "INVALID");
- break;
- case BeginFrameArgs::NORMAL:
- state->SetString("subtype", "NORMAL");
- break;
- case BeginFrameArgs::SYNCHRONOUS:
- state->SetString("subtype", "SYNCHRONOUS");
- break;
- case BeginFrameArgs::MISSED:
- state->SetString("subtype", "MISSED");
- break;
- }
+ state->SetString("subtype", TypeToString(type));
state->SetDouble("frame_time_us", frame_time.ToInternalValue());
state->SetDouble("deadline_us", deadline.ToInternalValue());
state->SetDouble("interval_us", interval.InMicroseconds());
}
-BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor(
- base::TimeTicks now) {
- // For WebView/SynchronousCompositor, we always want to draw immediately,
- // so we set the deadline to 0 and guess that the interval is 16 milliseconds.
- if (now.is_null())
- now = gfx::FrameTime::Now();
- return CreateTyped(
- now, base::TimeTicks(), DefaultInterval(), BeginFrameArgs::SYNCHRONOUS);
-}
-
// This is a hard-coded deadline adjustment that assumes 60Hz, to be used in
// cases where a good estimated draw time is not known. Using 1/3 of the vsync
// as the default adjustment gives the Browser the last 1/3 of a frame to
« no previous file with comments | « cc/output/begin_frame_args.h ('k') | cc/output/begin_frame_args_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698