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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 nullptr) { | 219 nullptr) { |
220 // g_shared_clock was assigned while we constructed/tried to assign our | 220 // g_shared_clock was assigned while we constructed/tried to assign our |
221 // instance, delete our instance and use the existing one. | 221 // instance, delete our instance and use the existing one. |
222 delete clock; | 222 delete clock; |
223 } | 223 } |
224 return g_shared_clock; | 224 return g_shared_clock; |
225 #elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) | 225 #elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) |
226 static UnixRealTimeClock clock; | 226 static UnixRealTimeClock clock; |
227 return &clock; | 227 return &clock; |
228 #else | 228 #else |
229 return NULL; | 229 return nullptr; |
230 #endif | 230 #endif |
231 } | 231 } |
232 | 232 |
233 SimulatedClock::SimulatedClock(int64_t initial_time_us) | 233 SimulatedClock::SimulatedClock(int64_t initial_time_us) |
234 : time_us_(initial_time_us), lock_(RWLockWrapper::CreateRWLock()) { | 234 : time_us_(initial_time_us), lock_(RWLockWrapper::CreateRWLock()) { |
235 } | 235 } |
236 | 236 |
237 SimulatedClock::~SimulatedClock() { | 237 SimulatedClock::~SimulatedClock() { |
238 } | 238 } |
239 | 239 |
(...skipping 21 matching lines...) Expand all Loading... |
261 void SimulatedClock::AdvanceTimeMilliseconds(int64_t milliseconds) { | 261 void SimulatedClock::AdvanceTimeMilliseconds(int64_t milliseconds) { |
262 AdvanceTimeMicroseconds(1000 * milliseconds); | 262 AdvanceTimeMicroseconds(1000 * milliseconds); |
263 } | 263 } |
264 | 264 |
265 void SimulatedClock::AdvanceTimeMicroseconds(int64_t microseconds) { | 265 void SimulatedClock::AdvanceTimeMicroseconds(int64_t microseconds) { |
266 WriteLockScoped synchronize(*lock_); | 266 WriteLockScoped synchronize(*lock_); |
267 time_us_ += microseconds; | 267 time_us_ += microseconds; |
268 } | 268 } |
269 | 269 |
270 }; // namespace webrtc | 270 }; // namespace webrtc |
OLD | NEW |