| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 uint32_t id, | 338 uint32_t id, |
| 339 MessageData* pdata) { | 339 MessageData* pdata) { |
| 340 return DoDelayPost(cmsDelay, TimeAfter(cmsDelay), phandler, id, pdata); | 340 return DoDelayPost(cmsDelay, TimeAfter(cmsDelay), phandler, id, pdata); |
| 341 } | 341 } |
| 342 | 342 |
| 343 void MessageQueue::PostAt(uint32_t tstamp, | 343 void MessageQueue::PostAt(uint32_t tstamp, |
| 344 MessageHandler* phandler, | 344 MessageHandler* phandler, |
| 345 uint32_t id, | 345 uint32_t id, |
| 346 MessageData* pdata) { | 346 MessageData* pdata) { |
| 347 // This should work even if it is used (unexpectedly). | 347 // This should work even if it is used (unexpectedly). |
| 348 int delay = static_cast<uint32_t>(TimeMillis()) - tstamp; | 348 int64_t delay = static_cast<uint32_t>(TimeMillis()) - tstamp; |
| 349 return DoDelayPost(delay, tstamp, phandler, id, pdata); | 349 return DoDelayPost(delay, tstamp, phandler, id, pdata); |
| 350 } | 350 } |
| 351 | 351 |
| 352 void MessageQueue::PostAt(int64_t tstamp, | 352 void MessageQueue::PostAt(int64_t tstamp, |
| 353 MessageHandler* phandler, | 353 MessageHandler* phandler, |
| 354 uint32_t id, | 354 uint32_t id, |
| 355 MessageData* pdata) { | 355 MessageData* pdata) { |
| 356 return DoDelayPost(TimeUntil(tstamp), tstamp, phandler, id, pdata); | 356 return DoDelayPost(TimeUntil(tstamp), tstamp, phandler, id, pdata); |
| 357 } | 357 } |
| 358 | 358 |
| 359 void MessageQueue::DoDelayPost(int cmsDelay, | 359 void MessageQueue::DoDelayPost(int64_t cmsDelay, |
| 360 int64_t tstamp, | 360 int64_t tstamp, |
| 361 MessageHandler* phandler, | 361 MessageHandler* phandler, |
| 362 uint32_t id, | 362 uint32_t id, |
| 363 MessageData* pdata) { | 363 MessageData* pdata) { |
| 364 if (fStop_) | 364 if (fStop_) { |
| 365 return; | 365 return; |
| 366 } |
| 366 | 367 |
| 367 // Keep thread safe | 368 // Keep thread safe |
| 368 // Add to the priority queue. Gets sorted soonest first. | 369 // Add to the priority queue. Gets sorted soonest first. |
| 369 // Signal for the multiplexer to return. | 370 // Signal for the multiplexer to return. |
| 370 | 371 |
| 371 { | 372 { |
| 372 CritScope cs(&crit_); | 373 CritScope cs(&crit_); |
| 373 Message msg; | 374 Message msg; |
| 374 msg.phandler = phandler; | 375 msg.phandler = phandler; |
| 375 msg.message_id = id; | 376 msg.message_id = id; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 dmsgq_.container().erase(new_end, dmsgq_.container().end()); | 450 dmsgq_.container().erase(new_end, dmsgq_.container().end()); |
| 450 dmsgq_.reheap(); | 451 dmsgq_.reheap(); |
| 451 } | 452 } |
| 452 | 453 |
| 453 void MessageQueue::Dispatch(Message *pmsg) { | 454 void MessageQueue::Dispatch(Message *pmsg) { |
| 454 TRACE_EVENT0("webrtc", "MessageQueue::Dispatch"); | 455 TRACE_EVENT0("webrtc", "MessageQueue::Dispatch"); |
| 455 pmsg->phandler->OnMessage(pmsg); | 456 pmsg->phandler->OnMessage(pmsg); |
| 456 } | 457 } |
| 457 | 458 |
| 458 } // namespace rtc | 459 } // namespace rtc |
| OLD | NEW |