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 12 matching lines...) Loading... |
23 | 23 |
24 const int kMaxMsgLatency = 150; // 150 ms | 24 const int kMaxMsgLatency = 150; // 150 ms |
25 const int kSlowDispatchLoggingThreshold = 50; // 50 ms | 25 const int kSlowDispatchLoggingThreshold = 50; // 50 ms |
26 | 26 |
27 class SCOPED_LOCKABLE DebugNonReentrantCritScope { | 27 class SCOPED_LOCKABLE DebugNonReentrantCritScope { |
28 public: | 28 public: |
29 DebugNonReentrantCritScope(const CriticalSection* cs, bool* locked) | 29 DebugNonReentrantCritScope(const CriticalSection* cs, bool* locked) |
30 EXCLUSIVE_LOCK_FUNCTION(cs) | 30 EXCLUSIVE_LOCK_FUNCTION(cs) |
31 : cs_(cs), locked_(locked) { | 31 : cs_(cs), locked_(locked) { |
32 cs_->Enter(); | 32 cs_->Enter(); |
33 ASSERT(!*locked_); | 33 RTC_DCHECK(!*locked_); |
34 *locked_ = true; | 34 *locked_ = true; |
35 } | 35 } |
36 | 36 |
37 ~DebugNonReentrantCritScope() UNLOCK_FUNCTION() { | 37 ~DebugNonReentrantCritScope() UNLOCK_FUNCTION() { |
38 *locked_ = false; | 38 *locked_ = false; |
39 cs_->Leave(); | 39 cs_->Leave(); |
40 } | 40 } |
41 | 41 |
42 private: | 42 private: |
43 const CriticalSection* const cs_; | 43 const CriticalSection* const cs_; |
(...skipping 278 matching lines...) Loading... |
322 // Log a warning for time-sensitive messages that we're late to deliver. | 322 // Log a warning for time-sensitive messages that we're late to deliver. |
323 if (pmsg->ts_sensitive) { | 323 if (pmsg->ts_sensitive) { |
324 int64_t delay = TimeDiff(msCurrent, pmsg->ts_sensitive); | 324 int64_t delay = TimeDiff(msCurrent, pmsg->ts_sensitive); |
325 if (delay > 0) { | 325 if (delay > 0) { |
326 LOG_F(LS_WARNING) << "id: " << pmsg->message_id << " delay: " | 326 LOG_F(LS_WARNING) << "id: " << pmsg->message_id << " delay: " |
327 << (delay + kMaxMsgLatency) << "ms"; | 327 << (delay + kMaxMsgLatency) << "ms"; |
328 } | 328 } |
329 } | 329 } |
330 // If this was a dispose message, delete it and skip it. | 330 // If this was a dispose message, delete it and skip it. |
331 if (MQID_DISPOSE == pmsg->message_id) { | 331 if (MQID_DISPOSE == pmsg->message_id) { |
332 ASSERT(NULL == pmsg->phandler); | 332 RTC_DCHECK(NULL == pmsg->phandler); |
333 delete pmsg->pdata; | 333 delete pmsg->pdata; |
334 *pmsg = Message(); | 334 *pmsg = Message(); |
335 continue; | 335 continue; |
336 } | 336 } |
337 return true; | 337 return true; |
338 } | 338 } |
339 | 339 |
340 if (IsQuitting()) | 340 if (IsQuitting()) |
341 break; | 341 break; |
342 | 342 |
(...skipping 190 matching lines...) Loading... |
533 pmsg->phandler->OnMessage(pmsg); | 533 pmsg->phandler->OnMessage(pmsg); |
534 int64_t end_time = TimeMillis(); | 534 int64_t end_time = TimeMillis(); |
535 int64_t diff = TimeDiff(end_time, start_time); | 535 int64_t diff = TimeDiff(end_time, start_time); |
536 if (diff >= kSlowDispatchLoggingThreshold) { | 536 if (diff >= kSlowDispatchLoggingThreshold) { |
537 LOG(LS_INFO) << "Message took " << diff << "ms to dispatch. Posted from: " | 537 LOG(LS_INFO) << "Message took " << diff << "ms to dispatch. Posted from: " |
538 << pmsg->posted_from.ToString(); | 538 << pmsg->posted_from.ToString(); |
539 } | 539 } |
540 } | 540 } |
541 | 541 |
542 } // namespace rtc | 542 } // namespace rtc |
OLD | NEW |