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

Side by Side Diff: cc/output/begin_frame_args.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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/output/begin_frame_args.h ('k') | cc/output/begin_frame_args_unittest.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/output/begin_frame_args.h" 5 #include "cc/output/begin_frame_args.h"
6 6
7 #include "base/debug/trace_event_argument.h" 7 #include "base/debug/trace_event_argument.h"
8 #include "ui/gfx/frame_time.h" 8 #include "ui/gfx/frame_time.h"
9 9
10 namespace cc { 10 namespace cc {
(...skipping 23 matching lines...) Expand all
34 BeginFrameArgs::BeginFrameArgs(base::TimeTicks frame_time, 34 BeginFrameArgs::BeginFrameArgs(base::TimeTicks frame_time,
35 base::TimeTicks deadline, 35 base::TimeTicks deadline,
36 base::TimeDelta interval, 36 base::TimeDelta interval,
37 BeginFrameArgs::BeginFrameArgsType type) 37 BeginFrameArgs::BeginFrameArgsType type)
38 : frame_time(frame_time), 38 : frame_time(frame_time),
39 deadline(deadline), 39 deadline(deadline),
40 interval(interval), 40 interval(interval),
41 type(type) { 41 type(type) {
42 } 42 }
43 43
44 BeginFrameArgs BeginFrameArgs::Create(base::TimeTicks frame_time, 44 BeginFrameArgs BeginFrameArgs::Create(BeginFrameArgs::CreationLocation location,
45 base::TimeTicks frame_time,
45 base::TimeTicks deadline, 46 base::TimeTicks deadline,
46 base::TimeDelta interval, 47 base::TimeDelta interval,
47 BeginFrameArgs::BeginFrameArgsType type) { 48 BeginFrameArgs::BeginFrameArgsType type) {
48 DCHECK_NE(type, BeginFrameArgs::INVALID); 49 DCHECK_NE(type, BeginFrameArgs::INVALID);
50 #ifdef NDEBUG
49 return BeginFrameArgs(frame_time, deadline, interval, type); 51 return BeginFrameArgs(frame_time, deadline, interval, type);
52 #else
53 BeginFrameArgs args = BeginFrameArgs(frame_time, deadline, interval, type);
54 args.created_from = location;
55 return args;
56 #endif
50 } 57 }
51 58
52 scoped_refptr<base::debug::ConvertableToTraceFormat> BeginFrameArgs::AsValue() 59 scoped_refptr<base::debug::ConvertableToTraceFormat> BeginFrameArgs::AsValue()
53 const { 60 const {
54 scoped_refptr<base::debug::TracedValue> state = 61 scoped_refptr<base::debug::TracedValue> state =
55 new base::debug::TracedValue(); 62 new base::debug::TracedValue();
56 AsValueInto(state.get()); 63 AsValueInto(state.get());
57 return state; 64 return state;
58 } 65 }
59 66
60 void BeginFrameArgs::AsValueInto(base::debug::TracedValue* state) const { 67 void BeginFrameArgs::AsValueInto(base::debug::TracedValue* state) const {
61 state->SetString("type", "BeginFrameArgs"); 68 state->SetString("type", "BeginFrameArgs");
62 state->SetString("subtype", TypeToString(type)); 69 state->SetString("subtype", TypeToString(type));
63 state->SetDouble("frame_time_us", frame_time.ToInternalValue()); 70 state->SetDouble("frame_time_us", frame_time.ToInternalValue());
64 state->SetDouble("deadline_us", deadline.ToInternalValue()); 71 state->SetDouble("deadline_us", deadline.ToInternalValue());
65 state->SetDouble("interval_us", interval.InMicroseconds()); 72 state->SetDouble("interval_us", interval.InMicroseconds());
73 #ifndef NDEBUG
74 state->SetString("created_from", created_from.ToString());
75 #endif
66 } 76 }
67 77
68 // This is a hard-coded deadline adjustment that assumes 60Hz, to be used in 78 // This is a hard-coded deadline adjustment that assumes 60Hz, to be used in
69 // cases where a good estimated draw time is not known. Using 1/3 of the vsync 79 // cases where a good estimated draw time is not known. Using 1/3 of the vsync
70 // as the default adjustment gives the Browser the last 1/3 of a frame to 80 // as the default adjustment gives the Browser the last 1/3 of a frame to
71 // produce output, the Renderer Impl thread the middle 1/3 of a frame to produce 81 // produce output, the Renderer Impl thread the middle 1/3 of a frame to produce
72 // ouput, and the Renderer Main thread the first 1/3 of a frame to produce 82 // ouput, and the Renderer Main thread the first 1/3 of a frame to produce
73 // output. 83 // output.
74 base::TimeDelta BeginFrameArgs::DefaultEstimatedParentDrawTime() { 84 base::TimeDelta BeginFrameArgs::DefaultEstimatedParentDrawTime() {
75 return base::TimeDelta::FromMicroseconds(16666 / 3); 85 return base::TimeDelta::FromMicroseconds(16666 / 3);
76 } 86 }
77 87
78 base::TimeDelta BeginFrameArgs::DefaultInterval() { 88 base::TimeDelta BeginFrameArgs::DefaultInterval() {
79 return base::TimeDelta::FromMicroseconds(16666); 89 return base::TimeDelta::FromMicroseconds(16666);
80 } 90 }
81 91
82 base::TimeDelta BeginFrameArgs::DefaultRetroactiveBeginFramePeriod() { 92 base::TimeDelta BeginFrameArgs::DefaultRetroactiveBeginFramePeriod() {
83 return base::TimeDelta::FromMicroseconds(4444); 93 return base::TimeDelta::FromMicroseconds(4444);
84 } 94 }
85 95
86 } // namespace cc 96 } // namespace cc
OLDNEW
« 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