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

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

Issue 1891293002: Adds clearer function to create rtc::Thread without Physical SocketServer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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/base.gyp ('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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 class MessageQueue { 169 class MessageQueue {
170 public: 170 public:
171 static const int kForever = -1; 171 static const int kForever = -1;
172 172
173 // Create a new MessageQueue and optionally assign it to the passed 173 // Create a new MessageQueue and optionally assign it to the passed
174 // SocketServer. Subclasses that override Clear should pass false for 174 // SocketServer. Subclasses that override Clear should pass false for
175 // init_queue and call DoInit() from their constructor to prevent races 175 // init_queue and call DoInit() from their constructor to prevent races
176 // with the MessageQueueManager using the object while the vtable is still 176 // with the MessageQueueManager using the object while the vtable is still
177 // being created. 177 // being created.
178 explicit MessageQueue(SocketServer* ss = NULL, 178 MessageQueue(SocketServer* ss, bool init_queue);
179 bool init_queue = true); 179 MessageQueue(std::unique_ptr<SocketServer> ss, bool init_queue);
180 180
181 // NOTE: SUBCLASSES OF MessageQueue THAT OVERRIDE Clear MUST CALL 181 // NOTE: SUBCLASSES OF MessageQueue THAT OVERRIDE Clear MUST CALL
182 // DoDestroy() IN THEIR DESTRUCTORS! This is required to avoid a data race 182 // DoDestroy() IN THEIR DESTRUCTORS! This is required to avoid a data race
183 // between the destructor modifying the vtable, and the MessageQueueManager 183 // between the destructor modifying the vtable, and the MessageQueueManager
184 // calling Clear on the object from a different thread. 184 // calling Clear on the object from a different thread.
185 virtual ~MessageQueue(); 185 virtual ~MessageQueue();
186 186
187 SocketServer* socketserver(); 187 SocketServer* socketserver();
188 void set_socketserver(SocketServer* ss); 188 void set_socketserver(SocketServer* ss);
189 189
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 bool fPeekKeep_; 269 bool fPeekKeep_;
270 Message msgPeek_; 270 Message msgPeek_;
271 MessageList msgq_ GUARDED_BY(crit_); 271 MessageList msgq_ GUARDED_BY(crit_);
272 PriorityQueue dmsgq_ GUARDED_BY(crit_); 272 PriorityQueue dmsgq_ GUARDED_BY(crit_);
273 uint32_t dmsgq_next_num_ GUARDED_BY(crit_); 273 uint32_t dmsgq_next_num_ GUARDED_BY(crit_);
274 CriticalSection crit_; 274 CriticalSection crit_;
275 bool fInitialized_; 275 bool fInitialized_;
276 bool fDestroyed_; 276 bool fDestroyed_;
277 277
278 private: 278 private:
279 // The SocketServer is not owned by MessageQueue. 279 // The SocketServer might not be owned by MessageQueue.
280 SocketServer* ss_ GUARDED_BY(ss_lock_); 280 SocketServer* ss_ GUARDED_BY(ss_lock_);
281 // If a server isn't supplied in the constructor, use this one. 281 // Used if SocketServer ownership lies with |this|.
282 std::unique_ptr<SocketServer> default_ss_; 282 std::unique_ptr<SocketServer> own_ss_;
283 SharedExclusiveLock ss_lock_; 283 SharedExclusiveLock ss_lock_;
284 284
285 RTC_DISALLOW_COPY_AND_ASSIGN(MessageQueue); 285 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue);
286 }; 286 };
287 287
288 } // namespace rtc 288 } // namespace rtc
289 289
290 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ 290 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_
OLDNEW
« no previous file with comments | « webrtc/base/base.gyp ('k') | webrtc/base/messagequeue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698