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

Side by Side Diff: net/socket/socket_descriptor.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 | « net/socket/socket.h ('k') | net/socket/socket_descriptor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_SOCKET_SOCKET_DESCRIPTOR_H_
6 #define NET_SOCKET_SOCKET_DESCRIPTOR_H_
7
8 #include "build/build_config.h"
9 #include "net/base/net_export.h"
10
11 #if defined(OS_WIN)
12 #include <winsock2.h>
13 #endif // OS_WIN
14
15 namespace net {
16
17 #if defined(OS_POSIX)
18 typedef int SocketDescriptor;
19 const SocketDescriptor kInvalidSocket = -1;
20 #elif defined(OS_WIN)
21 typedef SOCKET SocketDescriptor;
22 const SocketDescriptor kInvalidSocket = INVALID_SOCKET;
23 #endif
24
25 // Interface to create native socket.
26 // Usually such factories are used for testing purposes, which is not true in
27 // this case. This interface is used to substitute WSASocket/socket to make
28 // possible execution of some network code in sandbox.
29 class NET_EXPORT PlatformSocketFactory {
30 public:
31 PlatformSocketFactory();
32 virtual ~PlatformSocketFactory();
33
34 // Replace WSASocket/socket with given factory. The factory will be used by
35 // CreatePlatformSocket.
36 static void SetInstance(PlatformSocketFactory* factory);
37
38 // Creates socket. See WSASocket/socket documentation of parameters.
39 virtual SocketDescriptor CreateSocket(int family, int type, int protocol) = 0;
40 };
41
42 // Creates socket. See WSASocket/socket documentation of parameters.
43 SocketDescriptor NET_EXPORT CreatePlatformSocket(int family,
44 int type,
45 int protocol);
46
47 } // namespace net
48
49 #endif // NET_SOCKET_SOCKET_DESCRIPTOR_H_
OLDNEW
« no previous file with comments | « net/socket/socket.h ('k') | net/socket/socket_descriptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698