OLD | NEW |
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/trace_event/trace_event_argument.h" | 7 #include "base/trace_event/trace_event_argument.h" |
8 #include "cc/proto/base_conversions.h" | 8 #include "cc/proto/base_conversions.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
(...skipping 11 matching lines...) Expand all Loading... |
22 } | 22 } |
23 NOTREACHED(); | 23 NOTREACHED(); |
24 return "???"; | 24 return "???"; |
25 } | 25 } |
26 | 26 |
27 BeginFrameArgs::BeginFrameArgs() | 27 BeginFrameArgs::BeginFrameArgs() |
28 : frame_time(base::TimeTicks()), | 28 : frame_time(base::TimeTicks()), |
29 deadline(base::TimeTicks()), | 29 deadline(base::TimeTicks()), |
30 interval(base::TimeDelta::FromMicroseconds(-1)), | 30 interval(base::TimeDelta::FromMicroseconds(-1)), |
31 type(BeginFrameArgs::INVALID), | 31 type(BeginFrameArgs::INVALID), |
32 on_critical_path(true) { | 32 on_critical_path(true), |
33 } | 33 allow_latency_optimizations(true) {} |
34 | 34 |
35 BeginFrameArgs::BeginFrameArgs(base::TimeTicks frame_time, | 35 BeginFrameArgs::BeginFrameArgs(base::TimeTicks frame_time, |
36 base::TimeTicks deadline, | 36 base::TimeTicks deadline, |
37 base::TimeDelta interval, | 37 base::TimeDelta interval, |
38 BeginFrameArgs::BeginFrameArgsType type) | 38 BeginFrameArgs::BeginFrameArgsType type) |
39 : frame_time(frame_time), | 39 : frame_time(frame_time), |
40 deadline(deadline), | 40 deadline(deadline), |
41 interval(interval), | 41 interval(interval), |
42 type(type), | 42 type(type), |
43 on_critical_path(true) { | 43 on_critical_path(true), |
44 } | 44 allow_latency_optimizations(true) {} |
45 | 45 |
46 BeginFrameArgs BeginFrameArgs::Create(BeginFrameArgs::CreationLocation location, | 46 BeginFrameArgs BeginFrameArgs::Create(BeginFrameArgs::CreationLocation location, |
47 base::TimeTicks frame_time, | 47 base::TimeTicks frame_time, |
48 base::TimeTicks deadline, | 48 base::TimeTicks deadline, |
49 base::TimeDelta interval, | 49 base::TimeDelta interval, |
50 BeginFrameArgs::BeginFrameArgsType type) { | 50 BeginFrameArgs::BeginFrameArgsType type) { |
51 DCHECK_NE(type, BeginFrameArgs::INVALID); | 51 DCHECK_NE(type, BeginFrameArgs::INVALID); |
52 DCHECK_NE(type, BeginFrameArgs::BEGIN_FRAME_ARGS_TYPE_MAX); | 52 DCHECK_NE(type, BeginFrameArgs::BEGIN_FRAME_ARGS_TYPE_MAX); |
53 #ifdef NDEBUG | 53 #ifdef NDEBUG |
54 return BeginFrameArgs(frame_time, deadline, interval, type); | 54 return BeginFrameArgs(frame_time, deadline, interval, type); |
(...skipping 15 matching lines...) Expand all Loading... |
70 void BeginFrameArgs::AsValueInto(base::trace_event::TracedValue* state) const { | 70 void BeginFrameArgs::AsValueInto(base::trace_event::TracedValue* state) const { |
71 state->SetString("type", "BeginFrameArgs"); | 71 state->SetString("type", "BeginFrameArgs"); |
72 state->SetString("subtype", TypeToString(type)); | 72 state->SetString("subtype", TypeToString(type)); |
73 state->SetDouble("frame_time_us", frame_time.ToInternalValue()); | 73 state->SetDouble("frame_time_us", frame_time.ToInternalValue()); |
74 state->SetDouble("deadline_us", deadline.ToInternalValue()); | 74 state->SetDouble("deadline_us", deadline.ToInternalValue()); |
75 state->SetDouble("interval_us", interval.InMicroseconds()); | 75 state->SetDouble("interval_us", interval.InMicroseconds()); |
76 #ifndef NDEBUG | 76 #ifndef NDEBUG |
77 state->SetString("created_from", created_from.ToString()); | 77 state->SetString("created_from", created_from.ToString()); |
78 #endif | 78 #endif |
79 state->SetBoolean("on_critical_path", on_critical_path); | 79 state->SetBoolean("on_critical_path", on_critical_path); |
| 80 state->SetBoolean("allow_latency_optimizations", allow_latency_optimizations); |
80 } | 81 } |
81 | 82 |
82 // This is a hard-coded deadline adjustment that assumes 60Hz, to be used in | 83 // This is a hard-coded deadline adjustment that assumes 60Hz, to be used in |
83 // cases where a good estimated draw time is not known. Using 1/3 of the vsync | 84 // cases where a good estimated draw time is not known. Using 1/3 of the vsync |
84 // as the default adjustment gives the Browser the last 1/3 of a frame to | 85 // as the default adjustment gives the Browser the last 1/3 of a frame to |
85 // produce output, the Renderer Impl thread the middle 1/3 of a frame to produce | 86 // produce output, the Renderer Impl thread the middle 1/3 of a frame to produce |
86 // ouput, and the Renderer Main thread the first 1/3 of a frame to produce | 87 // ouput, and the Renderer Main thread the first 1/3 of a frame to produce |
87 // output. | 88 // output. |
88 base::TimeDelta BeginFrameArgs::DefaultEstimatedParentDrawTime() { | 89 base::TimeDelta BeginFrameArgs::DefaultEstimatedParentDrawTime() { |
89 return base::TimeDelta::FromMicroseconds(16666 / 3); | 90 return base::TimeDelta::FromMicroseconds(16666 / 3); |
90 } | 91 } |
91 | 92 |
92 base::TimeDelta BeginFrameArgs::DefaultInterval() { | 93 base::TimeDelta BeginFrameArgs::DefaultInterval() { |
93 return base::TimeDelta::FromMicroseconds(16666); | 94 return base::TimeDelta::FromMicroseconds(16666); |
94 } | 95 } |
95 | 96 |
96 } // namespace cc | 97 } // namespace cc |
OLD | NEW |