OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 Logging::State::State() : tag(""), timestamp_ms(0), enabled(true) {} | 109 Logging::State::State() : tag(""), timestamp_ms(0), enabled(true) {} |
110 | 110 |
111 Logging::State::State(const std::string& tag, int64_t timestamp_ms, | 111 Logging::State::State(const std::string& tag, int64_t timestamp_ms, |
112 bool enabled) | 112 bool enabled) |
113 : tag(tag), | 113 : tag(tag), |
114 timestamp_ms(timestamp_ms), | 114 timestamp_ms(timestamp_ms), |
115 enabled(enabled) { | 115 enabled(enabled) { |
116 } | 116 } |
117 | 117 |
118 void Logging::State::MergePrevious(const State& previous) { | 118 void Logging::State::MergePrevious(const State& previous) { |
119 if (tag == "") { | 119 if (tag.empty()) { |
120 tag = previous.tag; | 120 tag = previous.tag; |
121 } else if (previous.tag != "") { | 121 } else if (!previous.tag.empty()) { |
122 tag = previous.tag + "_" + tag; | 122 tag = previous.tag + "_" + tag; |
123 } | 123 } |
124 timestamp_ms = std::max(previous.timestamp_ms, timestamp_ms); | 124 timestamp_ms = std::max(previous.timestamp_ms, timestamp_ms); |
125 enabled = previous.enabled && enabled; | 125 enabled = previous.enabled && enabled; |
126 } | 126 } |
127 | 127 |
128 void Logging::PushState(const std::string& append_to_tag, int64_t timestamp_ms, | 128 void Logging::PushState(const std::string& append_to_tag, int64_t timestamp_ms, |
129 bool enabled) { | 129 bool enabled) { |
130 CriticalSectionScoped cs(crit_sect_.get()); | 130 CriticalSectionScoped cs(crit_sect_.get()); |
131 State new_state(append_to_tag, timestamp_ms, enabled); | 131 State new_state(append_to_tag, timestamp_ms, enabled); |
(...skipping 19 matching lines...) Expand all Loading... |
151 // Update time so that next log/plot will use the latest time seen so far | 151 // Update time so that next log/plot will use the latest time seen so far |
152 // in this call tree. | 152 // in this call tree. |
153 state->timestamp_ms = std::max(state->timestamp_ms, newest_timestamp_ms); | 153 state->timestamp_ms = std::max(state->timestamp_ms, newest_timestamp_ms); |
154 } | 154 } |
155 } | 155 } |
156 } // namespace bwe | 156 } // namespace bwe |
157 } // namespace testing | 157 } // namespace testing |
158 } // namespace webrtc | 158 } // namespace webrtc |
159 | 159 |
160 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE | 160 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE |
OLD | NEW |