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 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 MessageQueueManager(); | 61 MessageQueueManager(); |
62 ~MessageQueueManager(); | 62 ~MessageQueueManager(); |
63 | 63 |
64 void AddInternal(MessageQueue *message_queue); | 64 void AddInternal(MessageQueue *message_queue); |
65 void RemoveInternal(MessageQueue *message_queue); | 65 void RemoveInternal(MessageQueue *message_queue); |
66 void ClearInternal(MessageHandler *handler); | 66 void ClearInternal(MessageHandler *handler); |
67 void ProcessAllMessageQueuesInternal(); | 67 void ProcessAllMessageQueuesInternal(); |
68 | 68 |
69 static MessageQueueManager* instance_; | 69 static MessageQueueManager* instance_; |
70 // This list contains all live MessageQueues. | 70 // This list contains all live MessageQueues. |
71 std::vector<MessageQueue*> message_queues_ GUARDED_BY(crit_); | 71 std::vector<MessageQueue*> message_queues_ RTC_GUARDED_BY(crit_); |
72 | 72 |
73 // Methods that don't modify the list of message queues may be called in a | 73 // Methods that don't modify the list of message queues may be called in a |
74 // re-entrant fashion. "processing_" keeps track of the depth of re-entrant | 74 // re-entrant fashion. "processing_" keeps track of the depth of re-entrant |
75 // calls. | 75 // calls. |
76 CriticalSection crit_; | 76 CriticalSection crit_; |
77 size_t processing_ GUARDED_BY(crit_); | 77 size_t processing_ RTC_GUARDED_BY(crit_); |
78 }; | 78 }; |
79 | 79 |
80 // Derive from this for specialized data | 80 // Derive from this for specialized data |
81 // App manages lifetime, except when messages are purged | 81 // App manages lifetime, except when messages are purged |
82 | 82 |
83 class MessageData { | 83 class MessageData { |
84 public: | 84 public: |
85 MessageData() {} | 85 MessageData() {} |
86 virtual ~MessageData() {} | 86 virtual ~MessageData() {} |
87 }; | 87 }; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 void DoInit(); | 299 void DoInit(); |
300 | 300 |
301 // Perform cleanup, subclasses that override Clear must call this from the | 301 // Perform cleanup, subclasses that override Clear must call this from the |
302 // destructor. | 302 // destructor. |
303 void DoDestroy(); | 303 void DoDestroy(); |
304 | 304 |
305 void WakeUpSocketServer(); | 305 void WakeUpSocketServer(); |
306 | 306 |
307 bool fPeekKeep_; | 307 bool fPeekKeep_; |
308 Message msgPeek_; | 308 Message msgPeek_; |
309 MessageList msgq_ GUARDED_BY(crit_); | 309 MessageList msgq_ RTC_GUARDED_BY(crit_); |
310 PriorityQueue dmsgq_ GUARDED_BY(crit_); | 310 PriorityQueue dmsgq_ RTC_GUARDED_BY(crit_); |
311 uint32_t dmsgq_next_num_ GUARDED_BY(crit_); | 311 uint32_t dmsgq_next_num_ RTC_GUARDED_BY(crit_); |
312 CriticalSection crit_; | 312 CriticalSection crit_; |
313 bool fInitialized_; | 313 bool fInitialized_; |
314 bool fDestroyed_; | 314 bool fDestroyed_; |
315 | 315 |
316 private: | 316 private: |
317 volatile int stop_; | 317 volatile int stop_; |
318 | 318 |
319 // The SocketServer might not be owned by MessageQueue. | 319 // The SocketServer might not be owned by MessageQueue. |
320 SocketServer* const ss_; | 320 SocketServer* const ss_; |
321 // Used if SocketServer ownership lies with |this|. | 321 // Used if SocketServer ownership lies with |this|. |
322 std::unique_ptr<SocketServer> own_ss_; | 322 std::unique_ptr<SocketServer> own_ss_; |
323 | 323 |
324 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); | 324 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); |
325 }; | 325 }; |
326 | 326 |
327 } // namespace rtc | 327 } // namespace rtc |
328 | 328 |
329 #endif // WEBRTC_RTC_BASE_MESSAGEQUEUE_H_ | 329 #endif // WEBRTC_RTC_BASE_MESSAGEQUEUE_H_ |
OLD | NEW |