OLD | NEW |
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 <limits> | 5 #include <limits> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "cc/test/test_now_source.h" | 8 #include "cc/test/test_now_source.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 // TestNowSource::Convenience functions | 87 // TestNowSource::Convenience functions |
88 void TestNowSource::AdvanceNowMicroseconds(int64_t period_in_microseconds) { | 88 void TestNowSource::AdvanceNowMicroseconds(int64_t period_in_microseconds) { |
89 AdvanceNow(base::TimeDelta::FromMicroseconds(period_in_microseconds)); | 89 AdvanceNow(base::TimeDelta::FromMicroseconds(period_in_microseconds)); |
90 } | 90 } |
91 void TestNowSource::SetNowMicroseconds(int64_t time_in_microseconds) { | 91 void TestNowSource::SetNowMicroseconds(int64_t time_in_microseconds) { |
92 SetNow(base::TimeTicks::FromInternalValue(time_in_microseconds)); | 92 SetNow(base::TimeTicks::FromInternalValue(time_in_microseconds)); |
93 } | 93 } |
94 | 94 |
95 // TestNowSource::Tracing functions | 95 // TestNowSource::Tracing functions |
96 void TestNowSource::AsValueInto(base::debug::TracedValue* state) const { | 96 void TestNowSource::AsValueInto(base::trace_event::TracedValue* state) const { |
97 state->SetInteger("now_in_microseconds", now_.ToInternalValue()); | 97 state->SetInteger("now_in_microseconds", now_.ToInternalValue()); |
98 } | 98 } |
99 | 99 |
100 scoped_refptr<base::debug::ConvertableToTraceFormat> TestNowSource::AsValue() | 100 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
101 const { | 101 TestNowSource::AsValue() const { |
102 scoped_refptr<base::debug::TracedValue> state = | 102 scoped_refptr<base::trace_event::TracedValue> state = |
103 new base::debug::TracedValue(); | 103 new base::trace_event::TracedValue(); |
104 AsValueInto(state.get()); | 104 AsValueInto(state.get()); |
105 return state; | 105 return state; |
106 } | 106 } |
107 | 107 |
108 // TestNowSource::Pretty printing functions | 108 // TestNowSource::Pretty printing functions |
109 std::string TestNowSource::ToString() const { | 109 std::string TestNowSource::ToString() const { |
110 std::string output("TestNowSource("); | 110 std::string output("TestNowSource("); |
111 AsValue()->AppendAsTraceFormat(&output); | 111 AsValue()->AppendAsTraceFormat(&output); |
112 output += ")"; | 112 output += ")"; |
113 return output; | 113 return output; |
114 } | 114 } |
115 | 115 |
116 ::std::ostream& operator<<(::std::ostream& os, | 116 ::std::ostream& operator<<(::std::ostream& os, |
117 const scoped_refptr<TestNowSource>& src) { | 117 const scoped_refptr<TestNowSource>& src) { |
118 os << src->ToString(); | 118 os << src->ToString(); |
119 return os; | 119 return os; |
120 } | 120 } |
121 void PrintTo(const scoped_refptr<TestNowSource>& src, ::std::ostream* os) { | 121 void PrintTo(const scoped_refptr<TestNowSource>& src, ::std::ostream* os) { |
122 *os << src; | 122 *os << src; |
123 } | 123 } |
124 | 124 |
125 } // namespace cc | 125 } // namespace cc |
OLD | NEW |