0

net: Add NET_API to more code to enable building

a shared net library on Linux, and update base and
crypto API definitions.

BUG=76997
TEST=none
Review URL: http://codereview.chromium.org/7240021

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91234 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
rvargas@google.com
2011-06-30 23:51:24 +00:00
parent 3be6c69d07
commit 84ea2d04c0
11 changed files with 76 additions and 44 deletions

@ -8,15 +8,18 @@
#if defined(BASE_DLL)
#if defined(WIN32)
#if defined(BASE_IMPLEMENTATION)
#define BASE_API __declspec(dllexport)
#else
#define BASE_API __declspec(dllimport)
#endif // defined(BASE_IMPLEMENTATION)
#else
#else // defined(WIN32)
#define BASE_API __attribute__((visibility("default")))
#endif // defined(WIN32)
#else
#endif
#else // defined(BASE_DLL)
#define BASE_API
#endif

@ -8,15 +8,18 @@
#if defined(CRYPTO_DLL)
#if defined(WIN32)
#if defined(CRYPTO_IMPLEMENTATION)
#define CRYPTO_API __declspec(dllexport)
#else
#define CRYPTO_API __declspec(dllimport)
#endif // defined(CRYPTO_IMPLEMENTATION)
#else
#else // defined(WIN32)
#define CRYPTO_API __attribute__((visibility("default")))
#endif // defined(WIN32)
#else
#endif
#else // defined(CRYPTO_DLL)
#define CRYPTO_API
#endif

@ -10,7 +10,9 @@
// exported to consumers, and NET_TEST that allows unit tests to access features
// not intended to be used directly by real consumers.
#if defined(WIN32) && defined(NET_DLL)
#if defined(NET_DLL)
#if defined(WIN32)
#if defined(NET_IMPLEMENTATION)
#define NET_API __declspec(dllexport)
#define NET_TEST __declspec(dllexport)
@ -18,7 +20,13 @@
#define NET_API __declspec(dllimport)
#define NET_TEST __declspec(dllimport)
#endif // defined(NET_IMPLEMENTATION)
#else
#else // defined(WIN32)
#define NET_API __attribute__((visibility("default")))
#define NET_TEST __attribute__((visibility("default")))
#endif
#else /// defined(NET_DLL)
#define NET_API
#define NET_TEST
#endif

@ -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.
@ -11,6 +11,7 @@
#include "base/gtest_prod_util.h"
#include "base/native_library.h"
#include "base/string16.h"
#include "net/base/net_api.h"
#include "net/http/http_auth.h"
#define GSS_USE_FUNCTION_POINTERS
@ -26,7 +27,7 @@ extern gss_OID CHROME_GSS_KRB5_MECH_OID_DESC;
// library. The default implementation attempts to load one of the standard
// GSSAPI library implementations, then simply passes the arguments on to
// that implementation.
class GSSAPILibrary {
class NET_TEST GSSAPILibrary {
public:
virtual ~GSSAPILibrary() {}
@ -98,7 +99,7 @@ class GSSAPILibrary {
};
// GSSAPISharedLibrary class is defined here so that unit tests can access it.
class GSSAPISharedLibrary : public GSSAPILibrary {
class NET_TEST GSSAPISharedLibrary : public GSSAPILibrary {
public:
// If |gssapi_library_name| is empty, hard-coded default library names are
// used.
@ -213,7 +214,7 @@ class ScopedSecurityContext {
// TODO(ahendrickson): Share code with HttpAuthSSPI.
class HttpAuthGSSAPI {
class NET_TEST HttpAuthGSSAPI {
public:
HttpAuthGSSAPI(GSSAPILibrary* library,
const std::string& scheme,

@ -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.
@ -35,7 +35,7 @@ namespace net {
class URLSecurityManager;
// Code for handling HTTP NTLM authentication.
class HttpAuthHandlerNTLM : public HttpAuthHandler {
class NET_TEST HttpAuthHandlerNTLM : public HttpAuthHandler {
public:
class Factory : public HttpAuthHandlerFactory {
public:

@ -63,8 +63,36 @@ void HttpNetworkSession::RemoveResponseDrainer(
response_drainers_.erase(drainer);
}
SOCKSClientSocketPool* HttpNetworkSession::GetSocketPoolForSOCKSProxy(
const HostPortPair& socks_proxy) {
return socket_pool_manager_.GetSocketPoolForSOCKSProxy(socks_proxy);
}
HttpProxyClientSocketPool* HttpNetworkSession::GetSocketPoolForHTTPProxy(
const HostPortPair& http_proxy) {
return socket_pool_manager_.GetSocketPoolForHTTPProxy(http_proxy);
}
SSLClientSocketPool* HttpNetworkSession::GetSocketPoolForSSLWithProxy(
const HostPortPair& proxy_server) {
return socket_pool_manager_.GetSocketPoolForSSLWithProxy(proxy_server);
}
Value* HttpNetworkSession::SocketPoolInfoToValue() const {
return socket_pool_manager_.SocketPoolInfoToValue();
}
Value* HttpNetworkSession::SpdySessionPoolInfoToValue() const {
return spdy_session_pool_.SpdySessionPoolInfoToValue();
}
void HttpNetworkSession::CloseAllConnections() {
socket_pool_manager_.FlushSocketPools();
spdy_session_pool_.CloseCurrentSessions();
}
void HttpNetworkSession::CloseIdleConnections() {
socket_pool_manager_.CloseIdleSockets();
}
} // namespace net

@ -98,19 +98,13 @@ class NET_API HttpNetworkSession
}
SOCKSClientSocketPool* GetSocketPoolForSOCKSProxy(
const HostPortPair& socks_proxy) {
return socket_pool_manager_.GetSocketPoolForSOCKSProxy(socks_proxy);
}
const HostPortPair& socks_proxy);
HttpProxyClientSocketPool* GetSocketPoolForHTTPProxy(
const HostPortPair& http_proxy) {
return socket_pool_manager_.GetSocketPoolForHTTPProxy(http_proxy);
}
const HostPortPair& http_proxy);
SSLClientSocketPool* GetSocketPoolForSSLWithProxy(
const HostPortPair& proxy_server) {
return socket_pool_manager_.GetSocketPoolForSSLWithProxy(proxy_server);
}
const HostPortPair& proxy_server);
CertVerifier* cert_verifier() { return cert_verifier_; }
ProxyService* proxy_service() { return proxy_service_; }
@ -133,23 +127,14 @@ class NET_API HttpNetworkSession
// Creates a Value summary of the state of the socket pools. The caller is
// responsible for deleting the returned value.
Value* SocketPoolInfoToValue() const {
return socket_pool_manager_.SocketPoolInfoToValue();
}
Value* SocketPoolInfoToValue() const;
// Creates a Value summary of the state of the SPDY sessions. The caller is
// responsible for deleting the returned value.
Value* SpdySessionPoolInfoToValue() const;
void CloseAllConnections() {
socket_pool_manager_.FlushSocketPools();
spdy_session_pool_.CloseCurrentSessions();
}
void CloseIdleConnections() {
socket_pool_manager_.CloseIdleSockets();
}
void CloseAllConnections();
void CloseIdleConnections();
private:
friend class base::RefCounted<HttpNetworkSession>;

@ -6,6 +6,8 @@
#define NET_OCSP_NSS_OCSP_H_
#pragma once
#include "net/base/net_api.h"
namespace net {
class URLRequestContext;
@ -13,19 +15,19 @@ class URLRequestContext;
// Sets the MessageLoop for OCSP to the current message loop.
// This should be called before EnsureOCSPInit() if you want to
// control the message loop for OCSP.
void SetMessageLoopForOCSP();
NET_API void SetMessageLoopForOCSP();
// Initializes OCSP handlers for NSS. This must be called before any
// certificate verification functions. This function is thread-safe, and OCSP
// handlers will only ever be initialized once. ShutdownOCSP() must be called
// on shutdown.
void EnsureOCSPInit();
NET_API void EnsureOCSPInit();
// This should be called once on shutdown to stop issuing URLRequests for OCSP.
void ShutdownOCSP();
NET_API void ShutdownOCSP();
// Set URLRequestContext for OCSP handlers.
void SetURLRequestContextForOCSP(URLRequestContext* request_context);
NET_API void SetURLRequestContextForOCSP(URLRequestContext* request_context);
} // namespace net

@ -16,6 +16,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/observer_list.h"
#include "net/base/net_api.h"
#include "net/proxy/proxy_config.h"
#include "net/proxy/proxy_config_service.h"
#include "net/proxy/proxy_server.h"
@ -24,7 +25,7 @@ namespace net {
// Implementation of ProxyConfigService that retrieves the system proxy
// settings from environment variables, gconf, gsettings, or kioslaverc (KDE).
class BASE_API ProxyConfigServiceLinux : public ProxyConfigService {
class NET_TEST ProxyConfigServiceLinux : public ProxyConfigService {
public:
// Forward declaration of Delegate.

@ -20,7 +20,8 @@ namespace net {
class BoundNetLog;
// A client socket that uses TCP as the transport layer.
class TCPClientSocketLibevent : public StreamSocket, base::NonThreadSafe {
class NET_TEST TCPClientSocketLibevent : public StreamSocket,
public 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

@ -16,9 +16,9 @@ namespace net {
class IPEndPoint;
class TCPServerSocketLibevent : public ServerSocket,
public base::NonThreadSafe,
public MessageLoopForIO::Watcher {
class NET_TEST TCPServerSocketLibevent : public ServerSocket,
public base::NonThreadSafe,
public MessageLoopForIO::Watcher {
public:
TCPServerSocketLibevent(net::NetLog* net_log,
const net::NetLog::Source& source);