Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: webrtc/base/messagequeue.h

Issue 2131503002: Replace reentrant check to be more explicit and avoid a data race when comparing (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/criticalsection.h ('k') | webrtc/base/messagequeue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_; 71 std::vector<MessageQueue*> message_queues_ GUARDED_BY(crit_);
72
73 // Acquire this with DebugNonReentrantCritScope.
72 CriticalSection crit_; 74 CriticalSection crit_;
75 bool locked_ GUARDED_BY(crit_);
73 }; 76 };
74 77
75 // Derive from this for specialized data 78 // Derive from this for specialized data
76 // App manages lifetime, except when messages are purged 79 // App manages lifetime, except when messages are purged
77 80
78 class MessageData { 81 class MessageData {
79 public: 82 public:
80 MessageData() {} 83 MessageData() {}
81 virtual ~MessageData() {} 84 virtual ~MessageData() {}
82 }; 85 };
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 // Used if SocketServer ownership lies with |this|. 304 // Used if SocketServer ownership lies with |this|.
302 std::unique_ptr<SocketServer> own_ss_; 305 std::unique_ptr<SocketServer> own_ss_;
303 SharedExclusiveLock ss_lock_; 306 SharedExclusiveLock ss_lock_;
304 307
305 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); 308 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue);
306 }; 309 };
307 310
308 } // namespace rtc 311 } // namespace rtc
309 312
310 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ 313 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_
OLDNEW
« no previous file with comments | « webrtc/base/criticalsection.h ('k') | webrtc/base/messagequeue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698