summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-19 21:53:58 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-19 21:53:58 +0000
commitf89860148fa573627e19e6c9a3aa3cbfb58fb7cc (patch)
tree5844bd4ff873a84357ad7313c8af83b300709cd3
parent5121e678dd8ce395a7562f393d642301944d2408 (diff)
downloadchromium_src-f89860148fa573627e19e6c9a3aa3cbfb58fb7cc.zip
chromium_src-f89860148fa573627e19e6c9a3aa3cbfb58fb7cc.tar.gz
chromium_src-f89860148fa573627e19e6c9a3aa3cbfb58fb7cc.tar.bz2
Net: Add net_api to the socket code
BUG=76997 TEST=NONE Review URL: http://codereview.chromium.org/7011056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85982 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/socket/client_socket_factory.h5
-rw-r--r--net/socket/client_socket_handle.h3
-rw-r--r--net/socket/client_socket_pool.h3
-rw-r--r--net/socket/client_socket_pool_base.h9
-rw-r--r--net/socket/client_socket_pool_histograms.h3
-rw-r--r--net/socket/server_socket.h3
-rw-r--r--net/socket/socket.h5
-rw-r--r--net/socket/socks5_client_socket.h2
-rw-r--r--net/socket/socks_client_socket.h2
-rw-r--r--net/socket/socks_client_socket_pool.h4
-rw-r--r--net/socket/ssl_client_socket.h4
-rw-r--r--net/socket/ssl_client_socket_pool.h6
-rw-r--r--net/socket/ssl_server_socket.h3
-rw-r--r--net/socket/stream_socket.h4
-rw-r--r--net/socket/tcp_client_socket_win.h5
-rw-r--r--net/socket/tcp_server_socket_win.h7
-rw-r--r--net/socket/transport_client_socket_pool.h7
17 files changed, 43 insertions, 32 deletions
diff --git a/net/socket/client_socket_factory.h b/net/socket/client_socket_factory.h
index 31f117f..86d0d1e 100644
--- a/net/socket/client_socket_factory.h
+++ b/net/socket/client_socket_factory.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,7 @@
#include <string>
#include "base/basictypes.h"
+#include "net/base/net_api.h"
#include "net/base/net_log.h"
namespace net {
@@ -25,7 +26,7 @@ class StreamSocket;
// An interface used to instantiate StreamSocket objects. Used to facilitate
// testing code with mock socket implementations.
-class ClientSocketFactory {
+class NET_API ClientSocketFactory {
public:
virtual ~ClientSocketFactory() {}
diff --git a/net/socket/client_socket_handle.h b/net/socket/client_socket_handle.h
index df49151..c5b94dc 100644
--- a/net/socket/client_socket_handle.h
+++ b/net/socket/client_socket_handle.h
@@ -15,6 +15,7 @@
#include "net/base/completion_callback.h"
#include "net/base/load_states.h"
#include "net/base/net_errors.h"
+#include "net/base/net_api.h"
#include "net/base/net_log.h"
#include "net/base/request_priority.h"
#include "net/http/http_response_info.h"
@@ -29,7 +30,7 @@ namespace net {
// connection. It is used by the ClientSocketPool to group similar connected
// client socket objects.
//
-class ClientSocketHandle {
+class NET_API ClientSocketHandle {
public:
enum SocketReuseType {
UNUSED = 0, // unused socket that just finished connecting
diff --git a/net/socket/client_socket_pool.h b/net/socket/client_socket_pool.h
index 88e03ac..77d58fa 100644
--- a/net/socket/client_socket_pool.h
+++ b/net/socket/client_socket_pool.h
@@ -16,6 +16,7 @@
#include "net/base/completion_callback.h"
#include "net/base/host_resolver.h"
#include "net/base/load_states.h"
+#include "net/base/net_api.h"
#include "net/base/request_priority.h"
class DictionaryValue;
@@ -29,7 +30,7 @@ class StreamSocket;
// A ClientSocketPool is used to restrict the number of sockets open at a time.
// It also maintains a list of idle persistent sockets.
//
-class ClientSocketPool {
+class NET_API ClientSocketPool {
public:
// Requests a connected socket for a group_name.
//
diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h
index 318cab8..eb9d2a2 100644
--- a/net/socket/client_socket_pool_base.h
+++ b/net/socket/client_socket_pool_base.h
@@ -38,6 +38,7 @@
#include "net/base/address_list.h"
#include "net/base/completion_callback.h"
#include "net/base/load_states.h"
+#include "net/base/net_api.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
#include "net/base/network_change_notifier.h"
@@ -52,9 +53,9 @@ class ClientSocketHandle;
// ConnectJob provides an abstract interface for "connecting" a socket.
// The connection may involve host resolution, tcp connection, ssl connection,
// etc.
-class ConnectJob {
+class NET_TEST ConnectJob {
public:
- class Delegate {
+ class NET_TEST Delegate {
public:
Delegate() {}
virtual ~Delegate() {}
@@ -154,7 +155,7 @@ namespace internal {
// ClientSocketPoolBase adds templated definitions built on top of
// ClientSocketPoolBaseHelper. This class is not for external use, please use
// ClientSocketPoolBase instead.
-class ClientSocketPoolBaseHelper
+class NET_TEST ClientSocketPoolBaseHelper
: public ConnectJob::Delegate,
public NetworkChangeNotifier::IPAddressObserver {
public:
@@ -166,7 +167,7 @@ class ClientSocketPoolBaseHelper
NO_IDLE_SOCKETS = 0x1, // Do not return an idle socket. Create a new one.
};
- class Request {
+ class NET_TEST Request {
public:
Request(ClientSocketHandle* handle,
CompletionCallback* callback,
diff --git a/net/socket/client_socket_pool_histograms.h b/net/socket/client_socket_pool_histograms.h
index 0e5afff..a529d41 100644
--- a/net/socket/client_socket_pool_histograms.h
+++ b/net/socket/client_socket_pool_histograms.h
@@ -10,6 +10,7 @@
#include "base/memory/ref_counted.h"
#include "base/time.h"
+#include "net/base/net_api.h"
namespace base {
class Histogram;
@@ -17,7 +18,7 @@ class Histogram;
namespace net {
-class ClientSocketPoolHistograms {
+class NET_TEST ClientSocketPoolHistograms {
public:
ClientSocketPoolHistograms(const std::string& pool_name);
~ClientSocketPoolHistograms();
diff --git a/net/socket/server_socket.h b/net/socket/server_socket.h
index 4309304..2f86c3f 100644
--- a/net/socket/server_socket.h
+++ b/net/socket/server_socket.h
@@ -7,13 +7,14 @@
#include "base/scoped_ptr.h"
#include "net/base/completion_callback.h"
+#include "net/base/net_api.h"
namespace net {
class IPEndPoint;
class StreamSocket;
-class ServerSocket {
+class NET_API ServerSocket {
public:
ServerSocket() { }
virtual ~ServerSocket() { }
diff --git a/net/socket/socket.h b/net/socket/socket.h
index da17ce4..17d9f12 100644
--- a/net/socket/socket.h
+++ b/net/socket/socket.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,13 +7,14 @@
#pragma once
#include "net/base/completion_callback.h"
+#include "net/base/net_api.h"
namespace net {
class IOBuffer;
// Represents a read/write socket.
-class Socket {
+class NET_API Socket {
public:
virtual ~Socket() {}
diff --git a/net/socket/socks5_client_socket.h b/net/socket/socks5_client_socket.h
index 740be30..955ad90 100644
--- a/net/socket/socks5_client_socket.h
+++ b/net/socket/socks5_client_socket.h
@@ -27,7 +27,7 @@ class BoundNetLog;
// This StreamSocket is used to setup a SOCKSv5 handshake with a socks proxy.
// Currently no SOCKSv5 authentication is supported.
-class SOCKS5ClientSocket : public StreamSocket {
+class NET_TEST SOCKS5ClientSocket : public StreamSocket {
public:
// Takes ownership of the |transport_socket|, which should already be
// connected by the time Connect() is called.
diff --git a/net/socket/socks_client_socket.h b/net/socket/socks_client_socket.h
index ee0cd6a..c881f67 100644
--- a/net/socket/socks_client_socket.h
+++ b/net/socket/socks_client_socket.h
@@ -26,7 +26,7 @@ class ClientSocketHandle;
class BoundNetLog;
// The SOCKS client socket implementation
-class SOCKSClientSocket : public StreamSocket {
+class NET_TEST SOCKSClientSocket : public StreamSocket {
public:
// Takes ownership of the |transport_socket|, which should already be
// connected by the time Connect() is called.
diff --git a/net/socket/socks_client_socket_pool.h b/net/socket/socks_client_socket_pool.h
index bdef52f..e17273f 100644
--- a/net/socket/socks_client_socket_pool.h
+++ b/net/socket/socks_client_socket_pool.h
@@ -25,7 +25,7 @@ class ConnectJobFactory;
class TransportClientSocketPool;
class TransportSocketParams;
-class SOCKSSocketParams : public base::RefCounted<SOCKSSocketParams> {
+class NET_TEST SOCKSSocketParams : public base::RefCounted<SOCKSSocketParams> {
public:
SOCKSSocketParams(const scoped_refptr<TransportSocketParams>& proxy_server,
bool socks_v5, const HostPortPair& host_port_pair,
@@ -104,7 +104,7 @@ class SOCKSConnectJob : public ConnectJob {
DISALLOW_COPY_AND_ASSIGN(SOCKSConnectJob);
};
-class SOCKSClientSocketPool : public ClientSocketPool {
+class NET_TEST SOCKSClientSocketPool : public ClientSocketPool {
public:
SOCKSClientSocketPool(
int max_sockets,
diff --git a/net/socket/ssl_client_socket.h b/net/socket/ssl_client_socket.h
index 6de7916..dcf3383 100644
--- a/net/socket/ssl_client_socket.h
+++ b/net/socket/ssl_client_socket.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -42,7 +42,7 @@ class DNSSECProvider {
// connection is established. If a SSL error occurs during the handshake,
// Connect will fail.
//
-class SSLClientSocket : public StreamSocket {
+class NET_API SSLClientSocket : public StreamSocket {
public:
SSLClientSocket();
diff --git a/net/socket/ssl_client_socket_pool.h b/net/socket/ssl_client_socket_pool.h
index aa70134..8baab94 100644
--- a/net/socket/ssl_client_socket_pool.h
+++ b/net/socket/ssl_client_socket_pool.h
@@ -40,7 +40,7 @@ struct RRResponse;
// SSLSocketParams only needs the socket params for the transport socket
// that will be used (denoted by |proxy|).
-class SSLSocketParams : public base::RefCounted<SSLSocketParams> {
+class NET_TEST SSLSocketParams : public base::RefCounted<SSLSocketParams> {
public:
SSLSocketParams(const scoped_refptr<TransportSocketParams>& transport_params,
const scoped_refptr<SOCKSSocketParams>& socks_params,
@@ -170,8 +170,8 @@ class SSLConnectJob : public ConnectJob {
DISALLOW_COPY_AND_ASSIGN(SSLConnectJob);
};
-class SSLClientSocketPool : public ClientSocketPool,
- public SSLConfigService::Observer {
+class NET_TEST SSLClientSocketPool : public ClientSocketPool,
+ public SSLConfigService::Observer {
public:
// Only the pools that will be used are required. i.e. if you never
// try to create an SSL over SOCKS socket, |socks_pool| may be NULL.
diff --git a/net/socket/ssl_server_socket.h b/net/socket/ssl_server_socket.h
index 33ade01..61877d2 100644
--- a/net/socket/ssl_server_socket.h
+++ b/net/socket/ssl_server_socket.h
@@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "net/base/completion_callback.h"
+#include "net/base/net_api.h"
#include "net/socket/socket.h"
namespace crypto {
@@ -44,7 +45,7 @@ class SSLServerSocket : public Socket {
// is copied.
// TODO(hclam): Defines ServerSocketFactory to create SSLServerSocket. This will
// make mocking easier.
-SSLServerSocket* CreateSSLServerSocket(
+NET_API SSLServerSocket* CreateSSLServerSocket(
Socket* socket, X509Certificate* certificate, crypto::RSAPrivateKey* key,
const SSLConfig& ssl_config);
diff --git a/net/socket/stream_socket.h b/net/socket/stream_socket.h
index 37953ec..deed327 100644
--- a/net/socket/stream_socket.h
+++ b/net/socket/stream_socket.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,7 +14,7 @@ namespace net {
class AddressList;
class IPEndPoint;
-class StreamSocket : public Socket {
+class NET_TEST StreamSocket : public Socket {
public:
virtual ~StreamSocket() {}
diff --git a/net/socket/tcp_client_socket_win.h b/net/socket/tcp_client_socket_win.h
index 9e2765a..0c704e9 100644
--- a/net/socket/tcp_client_socket_win.h
+++ b/net/socket/tcp_client_socket_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,7 +18,8 @@ namespace net {
class BoundNetLog;
-class TCPClientSocketWin : public StreamSocket, base::NonThreadSafe {
+class NET_API TCPClientSocketWin : public StreamSocket,
+ NON_EXPORTED_BASE(base::NonThreadSafe) {
public:
// The IP address(es) and port number to connect to. The TCP socket will try
// each IP address in the list until it succeeds in establishing a
diff --git a/net/socket/tcp_server_socket_win.h b/net/socket/tcp_server_socket_win.h
index 4200b4c..2b49e22 100644
--- a/net/socket/tcp_server_socket_win.h
+++ b/net/socket/tcp_server_socket_win.h
@@ -18,9 +18,10 @@ namespace net {
class IPEndPoint;
-class TCPServerSocketWin : public ServerSocket,
- public base::NonThreadSafe,
- public base::win::ObjectWatcher::Delegate {
+class NET_TEST TCPServerSocketWin
+ : public ServerSocket,
+ NON_EXPORTED_BASE(public base::NonThreadSafe),
+ public base::win::ObjectWatcher::Delegate {
public:
TCPServerSocketWin(net::NetLog* net_log,
const net::NetLog::Source& source);
diff --git a/net/socket/transport_client_socket_pool.h b/net/socket/transport_client_socket_pool.h
index ae10682..33b60bc 100644
--- a/net/socket/transport_client_socket_pool.h
+++ b/net/socket/transport_client_socket_pool.h
@@ -23,7 +23,8 @@ namespace net {
class ClientSocketFactory;
-class TransportSocketParams : public base::RefCounted<TransportSocketParams> {
+class NET_TEST TransportSocketParams
+ : public base::RefCounted<TransportSocketParams> {
public:
TransportSocketParams(const HostPortPair& host_port_pair,
RequestPriority priority,
@@ -55,7 +56,7 @@ class TransportSocketParams : public base::RefCounted<TransportSocketParams> {
// (kIPv6FallbackTimerInMs) and start a connect() to a IPv4 address if the timer
// fires. Then we race the IPv4 connect() against the IPv6 connect() (which has
// a headstart) and return the one that completes first to the socket pool.
-class TransportConnectJob : public ConnectJob {
+class NET_TEST TransportConnectJob : public ConnectJob {
public:
TransportConnectJob(const std::string& group_name,
const scoped_refptr<TransportSocketParams>& params,
@@ -130,7 +131,7 @@ class TransportConnectJob : public ConnectJob {
DISALLOW_COPY_AND_ASSIGN(TransportConnectJob);
};
-class TransportClientSocketPool : public ClientSocketPool {
+class NET_TEST TransportClientSocketPool : public ClientSocketPool {
public:
TransportClientSocketPool(
int max_sockets,