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

Side by Side Diff: webrtc/base/socketserver.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/physicalsocketserver.cc ('k') | webrtc/base/thread.h » ('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
11 #ifndef WEBRTC_BASE_SOCKETSERVER_H_ 11 #ifndef WEBRTC_BASE_SOCKETSERVER_H_
12 #define WEBRTC_BASE_SOCKETSERVER_H_ 12 #define WEBRTC_BASE_SOCKETSERVER_H_
13 13
14 #include <memory>
14 #include "webrtc/base/socketfactory.h" 15 #include "webrtc/base/socketfactory.h"
15 16
16 namespace rtc { 17 namespace rtc {
17 18
18 class MessageQueue; 19 class MessageQueue;
19 class NetworkBinderInterface; 20 class NetworkBinderInterface;
20 21
21 // Provides the ability to wait for activity on a set of sockets. The Thread 22 // Provides the ability to wait for activity on a set of sockets. The Thread
22 // class provides a nice wrapper on a socket server. 23 // class provides a nice wrapper on a socket server.
23 // 24 //
24 // The server is also a socket factory. The sockets it creates will be 25 // The server is also a socket factory. The sockets it creates will be
25 // notified of asynchronous I/O from this server's Wait method. 26 // notified of asynchronous I/O from this server's Wait method.
26 class SocketServer : public SocketFactory { 27 class SocketServer : public SocketFactory {
27 public: 28 public:
28 static const int kForever = -1; 29 static const int kForever = -1;
29 30
31 static std::unique_ptr<SocketServer> CreateDefault();
30 // When the socket server is installed into a Thread, this function is 32 // When the socket server is installed into a Thread, this function is
31 // called to allow the socket server to use the thread's message queue for 33 // called to allow the socket server to use the thread's message queue for
32 // any messaging that it might need to perform. 34 // any messaging that it might need to perform.
33 virtual void SetMessageQueue(MessageQueue* queue) {} 35 virtual void SetMessageQueue(MessageQueue* queue) {}
34 36
35 // Sleeps until: 37 // Sleeps until:
36 // 1) cms milliseconds have elapsed (unless cms == kForever) 38 // 1) cms milliseconds have elapsed (unless cms == kForever)
37 // 2) WakeUp() is called 39 // 2) WakeUp() is called
38 // While sleeping, I/O is performed if process_io is true. 40 // While sleeping, I/O is performed if process_io is true.
39 virtual bool Wait(int cms, bool process_io) = 0; 41 virtual bool Wait(int cms, bool process_io) = 0;
40 42
41 // Causes the current wait (if one is in progress) to wake up. 43 // Causes the current wait (if one is in progress) to wake up.
42 virtual void WakeUp() = 0; 44 virtual void WakeUp() = 0;
43 45
44 // A network binder will bind the created sockets to a network. 46 // A network binder will bind the created sockets to a network.
45 // It is only used in PhysicalSocketServer. 47 // It is only used in PhysicalSocketServer.
46 void set_network_binder(NetworkBinderInterface* binder) { 48 void set_network_binder(NetworkBinderInterface* binder) {
47 network_binder_ = binder; 49 network_binder_ = binder;
48 } 50 }
49 NetworkBinderInterface* network_binder() const { return network_binder_; } 51 NetworkBinderInterface* network_binder() const { return network_binder_; }
50 52
51 private: 53 private:
52 NetworkBinderInterface* network_binder_ = nullptr; 54 NetworkBinderInterface* network_binder_ = nullptr;
53 }; 55 };
54 56
55 } // namespace rtc 57 } // namespace rtc
56 58
57 #endif // WEBRTC_BASE_SOCKETSERVER_H_ 59 #endif // WEBRTC_BASE_SOCKETSERVER_H_
OLDNEW
« no previous file with comments | « webrtc/base/physicalsocketserver.cc ('k') | webrtc/base/thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698