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 "ui/gfx/frame_time.h" | 8 #include "ui/gfx/frame_time.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); |
55 #else | 55 #else |
56 BeginFrameArgs args = BeginFrameArgs(frame_time, deadline, interval, type); | 56 BeginFrameArgs args = BeginFrameArgs(frame_time, deadline, interval, type); |
57 args.created_from = location; | 57 args.created_from = location; |
58 return args; | 58 return args; |
59 #endif | 59 #endif |
60 } | 60 } |
61 | 61 |
62 scoped_refptr<base::debug::ConvertableToTraceFormat> BeginFrameArgs::AsValue() | 62 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
63 const { | 63 BeginFrameArgs::AsValue() const { |
64 scoped_refptr<base::debug::TracedValue> state = | 64 scoped_refptr<base::trace_event::TracedValue> state = |
65 new base::debug::TracedValue(); | 65 new base::trace_event::TracedValue(); |
66 AsValueInto(state.get()); | 66 AsValueInto(state.get()); |
67 return state; | 67 return state; |
68 } | 68 } |
69 | 69 |
70 void BeginFrameArgs::AsValueInto(base::debug::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 } | 79 } |
80 | 80 |
81 // This is a hard-coded deadline adjustment that assumes 60Hz, to be used in | 81 // This is a hard-coded deadline adjustment that assumes 60Hz, to be used in |
82 // cases where a good estimated draw time is not known. Using 1/3 of the vsync | 82 // cases where a good estimated draw time is not known. Using 1/3 of the vsync |
83 // as the default adjustment gives the Browser the last 1/3 of a frame to | 83 // as the default adjustment gives the Browser the last 1/3 of a frame to |
84 // produce output, the Renderer Impl thread the middle 1/3 of a frame to produce | 84 // produce output, the Renderer Impl thread the middle 1/3 of a frame to produce |
85 // ouput, and the Renderer Main thread the first 1/3 of a frame to produce | 85 // ouput, and the Renderer Main thread the first 1/3 of a frame to produce |
86 // output. | 86 // output. |
87 base::TimeDelta BeginFrameArgs::DefaultEstimatedParentDrawTime() { | 87 base::TimeDelta BeginFrameArgs::DefaultEstimatedParentDrawTime() { |
88 return base::TimeDelta::FromMicroseconds(16666 / 3); | 88 return base::TimeDelta::FromMicroseconds(16666 / 3); |
89 } | 89 } |
90 | 90 |
91 base::TimeDelta BeginFrameArgs::DefaultInterval() { | 91 base::TimeDelta BeginFrameArgs::DefaultInterval() { |
92 return base::TimeDelta::FromMicroseconds(16666); | 92 return base::TimeDelta::FromMicroseconds(16666); |
93 } | 93 } |
94 | 94 |
95 } // namespace cc | 95 } // namespace cc |
OLD | NEW |