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

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

Issue 2828223002: Delete method MessageQueue::set_socketserver (Closed)
Patch Set: Use AutoSocketServerThread at one more place, missed in prev patchset. Created 3 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 | « no previous file | webrtc/base/messagequeue.cc » ('j') | webrtc/base/thread.h » ('J')
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
11 #ifndef WEBRTC_BASE_MESSAGEQUEUE_H_ 11 #ifndef WEBRTC_BASE_MESSAGEQUEUE_H_
12 #define WEBRTC_BASE_MESSAGEQUEUE_H_ 12 #define WEBRTC_BASE_MESSAGEQUEUE_H_
13 13
14 #include <string.h> 14 #include <string.h>
15 15
16 #include <algorithm> 16 #include <algorithm>
17 #include <list> 17 #include <list>
18 #include <memory> 18 #include <memory>
19 #include <queue> 19 #include <queue>
20 #include <utility> 20 #include <utility>
21 #include <vector> 21 #include <vector>
22 22
23 #include "webrtc/base/basictypes.h" 23 #include "webrtc/base/basictypes.h"
24 #include "webrtc/base/constructormagic.h" 24 #include "webrtc/base/constructormagic.h"
25 #include "webrtc/base/criticalsection.h" 25 #include "webrtc/base/criticalsection.h"
26 #include "webrtc/base/location.h" 26 #include "webrtc/base/location.h"
27 #include "webrtc/base/messagehandler.h" 27 #include "webrtc/base/messagehandler.h"
28 #include "webrtc/base/scoped_ref_ptr.h" 28 #include "webrtc/base/scoped_ref_ptr.h"
29 #include "webrtc/base/sharedexclusivelock.h"
30 #include "webrtc/base/sigslot.h" 29 #include "webrtc/base/sigslot.h"
31 #include "webrtc/base/socketserver.h" 30 #include "webrtc/base/socketserver.h"
32 #include "webrtc/base/timeutils.h" 31 #include "webrtc/base/timeutils.h"
33 #include "webrtc/base/thread_annotations.h" 32 #include "webrtc/base/thread_annotations.h"
34 33
35 namespace rtc { 34 namespace rtc {
36 35
37 struct Message; 36 struct Message;
38 class MessageQueue; 37 class MessageQueue;
39 38
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 MessageQueue(SocketServer* ss, bool init_queue); 202 MessageQueue(SocketServer* ss, bool init_queue);
204 MessageQueue(std::unique_ptr<SocketServer> ss, bool init_queue); 203 MessageQueue(std::unique_ptr<SocketServer> ss, bool init_queue);
205 204
206 // NOTE: SUBCLASSES OF MessageQueue THAT OVERRIDE Clear MUST CALL 205 // NOTE: SUBCLASSES OF MessageQueue THAT OVERRIDE Clear MUST CALL
207 // DoDestroy() IN THEIR DESTRUCTORS! This is required to avoid a data race 206 // DoDestroy() IN THEIR DESTRUCTORS! This is required to avoid a data race
208 // between the destructor modifying the vtable, and the MessageQueueManager 207 // between the destructor modifying the vtable, and the MessageQueueManager
209 // calling Clear on the object from a different thread. 208 // calling Clear on the object from a different thread.
210 virtual ~MessageQueue(); 209 virtual ~MessageQueue();
211 210
212 SocketServer* socketserver(); 211 SocketServer* socketserver();
213 void set_socketserver(SocketServer* ss);
214 212
215 // Note: The behavior of MessageQueue has changed. When a MQ is stopped, 213 // Note: The behavior of MessageQueue has changed. When a MQ is stopped,
216 // futher Posts and Sends will fail. However, any pending Sends and *ready* 214 // futher Posts and Sends will fail. However, any pending Sends and *ready*
217 // Posts (as opposed to unexpired delayed Posts) will be delivered before 215 // Posts (as opposed to unexpired delayed Posts) will be delivered before
218 // Get (or Peek) returns false. By guaranteeing delivery of those messages, 216 // Get (or Peek) returns false. By guaranteeing delivery of those messages,
219 // we eliminate the race condition when an MessageHandler and MessageQueue 217 // we eliminate the race condition when an MessageHandler and MessageQueue
220 // may be destroyed independently of each other. 218 // may be destroyed independently of each other.
221 virtual void Quit(); 219 virtual void Quit();
222 virtual bool IsQuitting(); 220 virtual bool IsQuitting();
223 virtual void Restart(); 221 virtual void Restart();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 PriorityQueue dmsgq_ GUARDED_BY(crit_); 308 PriorityQueue dmsgq_ GUARDED_BY(crit_);
311 uint32_t dmsgq_next_num_ GUARDED_BY(crit_); 309 uint32_t dmsgq_next_num_ GUARDED_BY(crit_);
312 CriticalSection crit_; 310 CriticalSection crit_;
313 bool fInitialized_; 311 bool fInitialized_;
314 bool fDestroyed_; 312 bool fDestroyed_;
315 313
316 private: 314 private:
317 volatile int stop_; 315 volatile int stop_;
318 316
319 // The SocketServer might not be owned by MessageQueue. 317 // The SocketServer might not be owned by MessageQueue.
320 SocketServer* ss_ GUARDED_BY(ss_lock_); 318 SocketServer* const ss_;
321 // Used if SocketServer ownership lies with |this|. 319 // Used if SocketServer ownership lies with |this|.
322 std::unique_ptr<SocketServer> own_ss_; 320 std::unique_ptr<SocketServer> own_ss_;
323 SharedExclusiveLock ss_lock_;
324 321
325 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); 322 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue);
326 }; 323 };
327 324
328 } // namespace rtc 325 } // namespace rtc
329 326
330 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ 327 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/messagequeue.cc » ('j') | webrtc/base/thread.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698