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> |
11 | 11 |
12 #include "webrtc/rtc_base/atomicops.h" | 12 #include "webrtc/rtc_base/atomicops.h" |
13 #include "webrtc/rtc_base/checks.h" | 13 #include "webrtc/rtc_base/checks.h" |
14 #include "webrtc/rtc_base/logging.h" | 14 #include "webrtc/rtc_base/logging.h" |
15 #include "webrtc/rtc_base/messagequeue.h" | 15 #include "webrtc/rtc_base/messagequeue.h" |
16 #include "webrtc/rtc_base/stringencode.h" | 16 #include "webrtc/rtc_base/stringencode.h" |
17 #include "webrtc/rtc_base/thread.h" | 17 #include "webrtc/rtc_base/thread.h" |
18 #include "webrtc/rtc_base/trace_event.h" | 18 #include "webrtc/rtc_base/trace_event.h" |
19 | 19 |
20 namespace rtc { | 20 namespace rtc { |
21 namespace { | 21 namespace { |
22 | 22 |
23 const int kMaxMsgLatency = 150; // 150 ms | 23 const int kMaxMsgLatency = 150; // 150 ms |
24 const int kSlowDispatchLoggingThreshold = 50; // 50 ms | 24 const int kSlowDispatchLoggingThreshold = 50; // 50 ms |
25 | 25 |
26 class RTC_SCOPED_LOCKABLE MarkProcessingCritScope { | 26 class SCOPED_LOCKABLE MarkProcessingCritScope { |
27 public: | 27 public: |
28 MarkProcessingCritScope(const CriticalSection* cs, size_t* processing) | 28 MarkProcessingCritScope(const CriticalSection* cs, size_t* processing) |
29 RTC_EXCLUSIVE_LOCK_FUNCTION(cs) | 29 EXCLUSIVE_LOCK_FUNCTION(cs) |
30 : cs_(cs), processing_(processing) { | 30 : cs_(cs), processing_(processing) { |
31 cs_->Enter(); | 31 cs_->Enter(); |
32 *processing_ += 1; | 32 *processing_ += 1; |
33 } | 33 } |
34 | 34 |
35 ~MarkProcessingCritScope() RTC_UNLOCK_FUNCTION() { | 35 ~MarkProcessingCritScope() UNLOCK_FUNCTION() { |
36 *processing_ -= 1; | 36 *processing_ -= 1; |
37 cs_->Leave(); | 37 cs_->Leave(); |
38 } | 38 } |
39 | 39 |
40 private: | 40 private: |
41 const CriticalSection* const cs_; | 41 const CriticalSection* const cs_; |
42 size_t* processing_; | 42 size_t* processing_; |
43 | 43 |
44 RTC_DISALLOW_COPY_AND_ASSIGN(MarkProcessingCritScope); | 44 RTC_DISALLOW_COPY_AND_ASSIGN(MarkProcessingCritScope); |
45 }; | 45 }; |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 pmsg->phandler->OnMessage(pmsg); | 530 pmsg->phandler->OnMessage(pmsg); |
531 int64_t end_time = TimeMillis(); | 531 int64_t end_time = TimeMillis(); |
532 int64_t diff = TimeDiff(end_time, start_time); | 532 int64_t diff = TimeDiff(end_time, start_time); |
533 if (diff >= kSlowDispatchLoggingThreshold) { | 533 if (diff >= kSlowDispatchLoggingThreshold) { |
534 LOG(LS_INFO) << "Message took " << diff << "ms to dispatch. Posted from: " | 534 LOG(LS_INFO) << "Message took " << diff << "ms to dispatch. Posted from: " |
535 << pmsg->posted_from.ToString(); | 535 << pmsg->posted_from.ToString(); |
536 } | 536 } |
537 } | 537 } |
538 | 538 |
539 } // namespace rtc | 539 } // namespace rtc |
OLD | NEW |