| 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 Message msg; | 446 Message msg; |
| 447 msg.posted_from = posted_from; | 447 msg.posted_from = posted_from; |
| 448 msg.phandler = phandler; | 448 msg.phandler = phandler; |
| 449 msg.message_id = id; | 449 msg.message_id = id; |
| 450 msg.pdata = pdata; | 450 msg.pdata = pdata; |
| 451 DelayedMessage dmsg(cmsDelay, tstamp, dmsgq_next_num_, msg); | 451 DelayedMessage dmsg(cmsDelay, tstamp, dmsgq_next_num_, msg); |
| 452 dmsgq_.push(dmsg); | 452 dmsgq_.push(dmsg); |
| 453 // If this message queue processes 1 message every millisecond for 50 days, | 453 // If this message queue processes 1 message every millisecond for 50 days, |
| 454 // we will wrap this number. Even then, only messages with identical times | 454 // we will wrap this number. Even then, only messages with identical times |
| 455 // will be misordered, and then only briefly. This is probably ok. | 455 // will be misordered, and then only briefly. This is probably ok. |
| 456 VERIFY(0 != ++dmsgq_next_num_); | 456 ++dmsgq_next_num_; |
| 457 RTC_DCHECK_NE(0, dmsgq_next_num_); |
| 457 } | 458 } |
| 458 WakeUpSocketServer(); | 459 WakeUpSocketServer(); |
| 459 } | 460 } |
| 460 | 461 |
| 461 int MessageQueue::GetDelay() { | 462 int MessageQueue::GetDelay() { |
| 462 CritScope cs(&crit_); | 463 CritScope cs(&crit_); |
| 463 | 464 |
| 464 if (!msgq_.empty()) | 465 if (!msgq_.empty()) |
| 465 return 0; | 466 return 0; |
| 466 | 467 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 pmsg->phandler->OnMessage(pmsg); | 533 pmsg->phandler->OnMessage(pmsg); |
| 533 int64_t end_time = TimeMillis(); | 534 int64_t end_time = TimeMillis(); |
| 534 int64_t diff = TimeDiff(end_time, start_time); | 535 int64_t diff = TimeDiff(end_time, start_time); |
| 535 if (diff >= kSlowDispatchLoggingThreshold) { | 536 if (diff >= kSlowDispatchLoggingThreshold) { |
| 536 LOG(LS_INFO) << "Message took " << diff << "ms to dispatch. Posted from: " | 537 LOG(LS_INFO) << "Message took " << diff << "ms to dispatch. Posted from: " |
| 537 << pmsg->posted_from.ToString(); | 538 << pmsg->posted_from.ToString(); |
| 538 } | 539 } |
| 539 } | 540 } |
| 540 | 541 |
| 541 } // namespace rtc | 542 } // namespace rtc |
| OLD | NEW |