diff options
author | hans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-09 22:27:31 +0000 |
---|---|---|
committer | hans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-09 22:27:31 +0000 |
commit | 2a848e0e4d75cd9195d15ff955014397482f9faa (patch) | |
tree | c01833c6bbc8948df2f4e43983a69b8e38a4dc51 /net | |
parent | f5f12389d59defd2f4a8deb2db53fa13004f3e38 (diff) | |
download | chromium_src-2a848e0e4d75cd9195d15ff955014397482f9faa.zip chromium_src-2a848e0e4d75cd9195d15ff955014397482f9faa.tar.gz chromium_src-2a848e0e4d75cd9195d15ff955014397482f9faa.tar.bz2 |
Clean-up inline members of nested classes (net/)
Due to a bug, the Clang-plugin style checker failed to warn about
inline constructors, destructors, non-empty virtual methods, etc.
for nested classes.
The plugin has been fixed, and this patch is part of a clean-up of all
the code that now causes the plugin to issue errors.
BUG=139346
Review URL: https://chromiumcodereview.appspot.com/10854063
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150917 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
36 files changed, 278 insertions, 140 deletions
diff --git a/net/base/multi_threaded_cert_verifier.cc b/net/base/multi_threaded_cert_verifier.cc index 701dc10..b2c3a0a 100644 --- a/net/base/multi_threaded_cert_verifier.cc +++ b/net/base/multi_threaded_cert_verifier.cc @@ -460,6 +460,16 @@ void MultiThreadedCertVerifier::CancelRequest(RequestHandle req) { request->Cancel(); } +MultiThreadedCertVerifier::RequestParams::RequestParams( + const SHA1Fingerprint& cert_fingerprint_arg, + const SHA1Fingerprint& ca_fingerprint_arg, + const std::string& hostname_arg, + int flags_arg) + : cert_fingerprint(cert_fingerprint_arg), + ca_fingerprint(ca_fingerprint_arg), + hostname(hostname_arg), + flags(flags_arg) {} + // HandleResult is called by CertVerifierWorker on the origin message loop. // It deletes CertVerifierJob. void MultiThreadedCertVerifier::HandleResult( diff --git a/net/base/multi_threaded_cert_verifier.h b/net/base/multi_threaded_cert_verifier.h index 1ef04ab..7407009 100644 --- a/net/base/multi_threaded_cert_verifier.h +++ b/net/base/multi_threaded_cert_verifier.h @@ -65,15 +65,11 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier RequestParamsComparators); // Input parameters of a certificate verification request. - struct RequestParams { + struct NET_EXPORT_PRIVATE RequestParams { RequestParams(const SHA1Fingerprint& cert_fingerprint_arg, const SHA1Fingerprint& ca_fingerprint_arg, const std::string& hostname_arg, - int flags_arg) - : cert_fingerprint(cert_fingerprint_arg), - ca_fingerprint(ca_fingerprint_arg), - hostname(hostname_arg), - flags(flags_arg) {} + int flags_arg); bool operator<(const RequestParams& other) const { // |flags| is compared before |cert_fingerprint|, |ca_fingerprint|, and diff --git a/net/base/network_change_notifier_mac.cc b/net/base/network_change_notifier_mac.cc index de4a943..c9af0484 100644 --- a/net/base/network_change_notifier_mac.cc +++ b/net/base/network_change_notifier_mac.cc @@ -82,6 +82,24 @@ NetworkChangeNotifierMac::GetCurrentConnectionType() const { return connection_type_; } +void NetworkChangeNotifierMac::Forwarder::Init() { + net_config_watcher_->SetInitialConnectionType(); +} + +void NetworkChangeNotifierMac::Forwarder::StartReachabilityNotifications() { + net_config_watcher_->StartReachabilityNotifications(); +} + +void NetworkChangeNotifierMac::Forwarder::SetDynamicStoreNotificationKeys( + SCDynamicStoreRef store) { + net_config_watcher_->SetDynamicStoreNotificationKeys(store); +} + +void NetworkChangeNotifierMac::Forwarder::OnNetworkConfigChange( + CFArrayRef changed_keys) { + net_config_watcher_->OnNetworkConfigChange(changed_keys); +} + void NetworkChangeNotifierMac::SetInitialConnectionType() { // Called on notifier thread. diff --git a/net/base/network_change_notifier_mac.h b/net/base/network_change_notifier_mac.h index 31ad4d5..7029929 100644 --- a/net/base/network_change_notifier_mac.h +++ b/net/base/network_change_notifier_mac.h @@ -36,19 +36,11 @@ class NetworkChangeNotifierMac: public NetworkChangeNotifier { : net_config_watcher_(net_config_watcher) {} // NetworkConfigWatcherMac::Delegate implementation: - virtual void Init() OVERRIDE { - net_config_watcher_->SetInitialConnectionType(); - } - virtual void StartReachabilityNotifications() OVERRIDE { - net_config_watcher_->StartReachabilityNotifications(); - } + virtual void Init() OVERRIDE; + virtual void StartReachabilityNotifications() OVERRIDE; virtual void SetDynamicStoreNotificationKeys( - SCDynamicStoreRef store) OVERRIDE { - net_config_watcher_->SetDynamicStoreNotificationKeys(store); - } - virtual void OnNetworkConfigChange(CFArrayRef changed_keys) OVERRIDE { - net_config_watcher_->OnNetworkConfigChange(changed_keys); - } + SCDynamicStoreRef store) OVERRIDE; + virtual void OnNetworkConfigChange(CFArrayRef changed_keys) OVERRIDE; private: NetworkChangeNotifierMac* const net_config_watcher_; diff --git a/net/base/transport_security_state.cc b/net/base/transport_security_state.cc index 747dc7e..db18853 100644 --- a/net/base/transport_security_state.cc +++ b/net/base/transport_security_state.cc @@ -54,6 +54,13 @@ TransportSecurityState::TransportSecurityState() : delegate_(NULL) { } +TransportSecurityState::Iterator::Iterator(const TransportSecurityState& state) + : iterator_(state.enabled_hosts_.begin()), + end_(state.enabled_hosts_.end()) { +} + +TransportSecurityState::Iterator::~Iterator() {} + void TransportSecurityState::SetDelegate( TransportSecurityState::Delegate* delegate) { delegate_ = delegate; diff --git a/net/base/transport_security_state.h b/net/base/transport_security_state.h index 2e4b42e..01c0a26 100644 --- a/net/base/transport_security_state.h +++ b/net/base/transport_security_state.h @@ -151,13 +151,10 @@ class NET_EXPORT TransportSecurityState std::string domain; }; - class Iterator { + class NET_EXPORT Iterator { public: - explicit Iterator(const TransportSecurityState& state) - : iterator_(state.enabled_hosts_.begin()), - end_(state.enabled_hosts_.end()) { - } - ~Iterator() {} + explicit Iterator(const TransportSecurityState& state); + ~Iterator(); bool HasNext() const { return iterator_ != end_; } void Advance() { ++iterator_; } diff --git a/net/disk_cache/rankings.cc b/net/disk_cache/rankings.cc index 6da1e1f..109a32a 100644 --- a/net/disk_cache/rankings.cc +++ b/net/disk_cache/rankings.cc @@ -189,6 +189,15 @@ void UpdateTimes(disk_cache::CacheRankingsBlock* node, bool modified) { namespace disk_cache { +Rankings::ScopedRankingsBlock::ScopedRankingsBlock() : rankings_(NULL) {} + +Rankings::ScopedRankingsBlock::ScopedRankingsBlock(Rankings* rankings) + : rankings_(rankings) {} + +Rankings::ScopedRankingsBlock::ScopedRankingsBlock( + Rankings* rankings, CacheRankingsBlock* node) + : scoped_ptr<CacheRankingsBlock>(node), rankings_(rankings) {} + Rankings::Iterator::Iterator(Rankings* rankings) { memset(this, 0, sizeof(Iterator)); my_rankings = rankings; diff --git a/net/disk_cache/rankings.h b/net/disk_cache/rankings.h index 703e8ae..94ab1fb 100644 --- a/net/disk_cache/rankings.h +++ b/net/disk_cache/rankings.h @@ -64,10 +64,9 @@ class Rankings { // iterators that may go stale. class ScopedRankingsBlock : public scoped_ptr<CacheRankingsBlock> { public: - ScopedRankingsBlock() : rankings_(NULL) {} - explicit ScopedRankingsBlock(Rankings* rankings) : rankings_(rankings) {} - ScopedRankingsBlock(Rankings* rankings, CacheRankingsBlock* node) - : scoped_ptr<CacheRankingsBlock>(node), rankings_(rankings) {} + ScopedRankingsBlock(); + explicit ScopedRankingsBlock(Rankings* rankings); + ScopedRankingsBlock(Rankings* rankings, CacheRankingsBlock* node); ~ScopedRankingsBlock() { rankings_->FreeRankingsBlock(get()); diff --git a/net/http/http_auth.cc b/net/http/http_auth.cc index 2e42b06..47a13be2 100644 --- a/net/http/http_auth.cc +++ b/net/http/http_auth.cc @@ -86,6 +86,18 @@ HttpAuth::AuthorizationResult HttpAuth::HandleChallengeResponse( return HttpAuth::AUTHORIZATION_RESULT_REJECT; } +HttpAuth::ChallengeTokenizer::ChallengeTokenizer( + std::string::const_iterator begin, + std::string::const_iterator end) + : begin_(begin), + end_(end), + scheme_begin_(begin), + scheme_end_(begin), + params_begin_(end), + params_end_(end) { + Init(begin, end); +} + HttpUtil::NameValuePairsIterator HttpAuth::ChallengeTokenizer::param_pairs() const { return HttpUtil::NameValuePairsIterator(params_begin_, params_end_, ','); diff --git a/net/http/http_auth.h b/net/http/http_auth.h index a42fc20..364f933 100644 --- a/net/http/http_auth.h +++ b/net/http/http_auth.h @@ -178,15 +178,7 @@ class NET_EXPORT_PRIVATE HttpAuth { class NET_EXPORT_PRIVATE ChallengeTokenizer { public: ChallengeTokenizer(std::string::const_iterator begin, - std::string::const_iterator end) - : begin_(begin), - end_(end), - scheme_begin_(begin), - scheme_end_(begin), - params_begin_(end), - params_end_(end) { - Init(begin, end); - } + std::string::const_iterator end); // Get the original text. std::string challenge_text() const { diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc index 0d9b459..124c570 100644 --- a/net/http/http_network_session.cc +++ b/net/http/http_network_session.cc @@ -46,6 +46,20 @@ net::ClientSocketPoolManager* CreateSocketPoolManager( namespace net { +HttpNetworkSession::Params::Params() + : client_socket_factory(NULL), + host_resolver(NULL), + cert_verifier(NULL), + server_bound_cert_service(NULL), + transport_security_state(NULL), + proxy_service(NULL), + ssl_config_service(NULL), + http_auth_handler_factory(NULL), + network_delegate(NULL), + http_server_properties(NULL), + net_log(NULL), + force_http_pipelining(false) {} + // TODO(mbelshe): Move the socket factories into HttpStreamFactory. HttpNetworkSession::HttpNetworkSession(const Params& params) : net_log_(params.net_log), diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h index 35b4bd0..3a9d72c 100644 --- a/net/http/http_network_session.h +++ b/net/http/http_network_session.h @@ -47,19 +47,7 @@ class NET_EXPORT HttpNetworkSession NON_EXPORTED_BASE(public base::NonThreadSafe) { public: struct NET_EXPORT Params { - Params() - : client_socket_factory(NULL), - host_resolver(NULL), - cert_verifier(NULL), - server_bound_cert_service(NULL), - transport_security_state(NULL), - proxy_service(NULL), - ssl_config_service(NULL), - http_auth_handler_factory(NULL), - network_delegate(NULL), - http_server_properties(NULL), - net_log(NULL), - force_http_pipelining(false) {} + Params(); ClientSocketFactory* client_socket_factory; HostResolver* host_resolver; diff --git a/net/http/http_pipelined_connection_impl.cc b/net/http/http_pipelined_connection_impl.cc index 1679cbc..141d58a 100644 --- a/net/http/http_pipelined_connection_impl.cc +++ b/net/http/http_pipelined_connection_impl.cc @@ -52,6 +52,22 @@ Value* NetLogHostPortPairCallback(const HostPortPair* host_port_pair, } // anonymous namespace +HttpPipelinedConnection* +HttpPipelinedConnectionImpl::Factory::CreateNewPipeline( + ClientSocketHandle* connection, + HttpPipelinedConnection::Delegate* delegate, + const HostPortPair& origin, + const SSLConfig& used_ssl_config, + const ProxyInfo& used_proxy_info, + const BoundNetLog& net_log, + bool was_npn_negotiated, + NextProto protocol_negotiated) { + return new HttpPipelinedConnectionImpl(connection, delegate, origin, + used_ssl_config, used_proxy_info, + net_log, was_npn_negotiated, + protocol_negotiated); +} + HttpPipelinedConnectionImpl::HttpPipelinedConnectionImpl( ClientSocketHandle* connection, HttpPipelinedConnection::Delegate* delegate, diff --git a/net/http/http_pipelined_connection_impl.h b/net/http/http_pipelined_connection_impl.h index be62885..ac43dcb 100644 --- a/net/http/http_pipelined_connection_impl.h +++ b/net/http/http_pipelined_connection_impl.h @@ -55,12 +55,7 @@ class NET_EXPORT_PRIVATE HttpPipelinedConnectionImpl const ProxyInfo& used_proxy_info, const BoundNetLog& net_log, bool was_npn_negotiated, - NextProto protocol_negotiated) OVERRIDE { - return new HttpPipelinedConnectionImpl(connection, delegate, origin, - used_ssl_config, used_proxy_info, - net_log, was_npn_negotiated, - protocol_negotiated); - } + NextProto protocol_negotiated) OVERRIDE; }; HttpPipelinedConnectionImpl(ClientSocketHandle* connection, diff --git a/net/http/http_proxy_client_socket_pool.cc b/net/http/http_proxy_client_socket_pool.cc index 249a052..8991735 100644 --- a/net/http/http_proxy_client_socket_pool.cc +++ b/net/http/http_proxy_client_socket_pool.cc @@ -380,6 +380,12 @@ HttpProxyClientSocketPool::HttpProxyConnectJobFactory::NewConnectJob( net_log_); } +base::TimeDelta +HttpProxyClientSocketPool::HttpProxyConnectJobFactory::ConnectionTimeout( + ) const { + return timeout_; +} + HttpProxyClientSocketPool::HttpProxyClientSocketPool( int max_sockets, int max_sockets_per_group, diff --git a/net/http/http_proxy_client_socket_pool.h b/net/http/http_proxy_client_socket_pool.h index f6a83ef..867131c 100644 --- a/net/http/http_proxy_client_socket_pool.h +++ b/net/http/http_proxy_client_socket_pool.h @@ -252,9 +252,7 @@ class NET_EXPORT_PRIVATE HttpProxyClientSocketPool const PoolBase::Request& request, ConnectJob::Delegate* delegate) const OVERRIDE; - virtual base::TimeDelta ConnectionTimeout() const OVERRIDE { - return timeout_; - } + virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; private: TransportClientSocketPool* const transport_pool_; diff --git a/net/proxy/proxy_config_service_mac.cc b/net/proxy/proxy_config_service_mac.cc index c27ede0..b4099d8 100644 --- a/net/proxy/proxy_config_service_mac.cc +++ b/net/proxy/proxy_config_service_mac.cc @@ -188,6 +188,16 @@ class ProxyConfigServiceMac::Helper ProxyConfigServiceMac* parent_; }; +void ProxyConfigServiceMac::Forwarder::SetDynamicStoreNotificationKeys( + SCDynamicStoreRef store) { + proxy_config_service_->SetDynamicStoreNotificationKeys(store); +} + +void ProxyConfigServiceMac::Forwarder::OnNetworkConfigChange( + CFArrayRef changed_keys) { + proxy_config_service_->OnNetworkConfigChange(changed_keys); +} + ProxyConfigServiceMac::ProxyConfigServiceMac( base::SingleThreadTaskRunner* io_thread_task_runner) : forwarder_(this), diff --git a/net/proxy/proxy_config_service_mac.h b/net/proxy/proxy_config_service_mac.h index 212ad58..acccd21 100644 --- a/net/proxy/proxy_config_service_mac.h +++ b/net/proxy/proxy_config_service_mac.h @@ -50,13 +50,9 @@ class NET_EXPORT ProxyConfigServiceMac : public ProxyConfigService { // NetworkConfigWatcherMac::Delegate implementation: virtual void StartReachabilityNotifications() OVERRIDE {} - virtual void SetDynamicStoreNotificationKeys(SCDynamicStoreRef store) - OVERRIDE { - proxy_config_service_->SetDynamicStoreNotificationKeys(store); - } - virtual void OnNetworkConfigChange(CFArrayRef changed_keys) OVERRIDE { - proxy_config_service_->OnNetworkConfigChange(changed_keys); - } + virtual void SetDynamicStoreNotificationKeys( + SCDynamicStoreRef store) OVERRIDE; + virtual void OnNetworkConfigChange(CFArrayRef changed_keys) OVERRIDE; private: ProxyConfigServiceMac* const proxy_config_service_; diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc index 8c11782..6092081 100644 --- a/net/socket/client_socket_pool_base.cc +++ b/net/socket/client_socket_pool_base.cc @@ -198,6 +198,16 @@ ClientSocketPoolBaseHelper::~ClientSocketPoolBaseHelper() { NetworkChangeNotifier::RemoveIPAddressObserver(this); } +ClientSocketPoolBaseHelper::CallbackResultPair::CallbackResultPair() + : result(OK) { +} + +ClientSocketPoolBaseHelper::CallbackResultPair::CallbackResultPair( + const CompletionCallback& callback_in, int result_in) + : callback(callback_in), + result(result_in) { +} + ClientSocketPoolBaseHelper::CallbackResultPair::~CallbackResultPair() {} // InsertRequestIntoQueue inserts the request into the queue based on diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h index 834835a..e35ab29 100644 --- a/net/socket/client_socket_pool_base.h +++ b/net/socket/client_socket_pool_base.h @@ -442,9 +442,8 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper typedef std::set<ConnectJob*> ConnectJobSet; struct CallbackResultPair { - CallbackResultPair() : result(OK) {} - CallbackResultPair(const CompletionCallback& callback_in, int result_in) - : callback(callback_in), result(result_in) {} + CallbackResultPair(); + CallbackResultPair(const CompletionCallback& callback_in, int result_in); ~CallbackResultPair(); CompletionCallback callback; diff --git a/net/socket/ssl_client_socket_pool.cc b/net/socket/ssl_client_socket_pool.cc index 842da86..21ebf97 100644 --- a/net/socket/ssl_client_socket_pool.cc +++ b/net/socket/ssl_client_socket_pool.cc @@ -491,6 +491,11 @@ ConnectJob* SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob( context_, delegate, net_log_); } +base::TimeDelta +SSLClientSocketPool::SSLConnectJobFactory::ConnectionTimeout() const { + return timeout_; +} + int SSLClientSocketPool::RequestSocket(const std::string& group_name, const void* socket_params, RequestPriority priority, diff --git a/net/socket/ssl_client_socket_pool.h b/net/socket/ssl_client_socket_pool.h index 4948cf5..8802afc 100644 --- a/net/socket/ssl_client_socket_pool.h +++ b/net/socket/ssl_client_socket_pool.h @@ -265,9 +265,7 @@ class NET_EXPORT_PRIVATE SSLClientSocketPool const PoolBase::Request& request, ConnectJob::Delegate* delegate) const OVERRIDE; - virtual base::TimeDelta ConnectionTimeout() const OVERRIDE { - return timeout_; - } + virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; private: TransportClientSocketPool* const transport_pool_; diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc index a3727ff..bd31cbe 100644 --- a/net/socket/tcp_client_socket_libevent.cc +++ b/net/socket/tcp_client_socket_libevent.cc @@ -579,6 +579,19 @@ bool TCPClientSocketLibevent::SetNoDelay(bool no_delay) { return SetTCPNoDelay(socket, no_delay); } +void TCPClientSocketLibevent::ReadWatcher::OnFileCanReadWithoutBlocking(int) { + if (!socket_->read_callback_.is_null()) + socket_->DidCompleteRead(); +} + +void TCPClientSocketLibevent::WriteWatcher::OnFileCanWriteWithoutBlocking(int) { + if (socket_->waiting_connect()) { + socket_->DidCompleteConnect(); + } else if (!socket_->write_callback_.is_null()) { + socket_->DidCompleteWrite(); + } +} + void TCPClientSocketLibevent::LogConnectCompletion(int net_error) { if (net_error == OK) UpdateConnectionTypeHistograms(CONNECTION_ANY); diff --git a/net/socket/tcp_client_socket_libevent.h b/net/socket/tcp_client_socket_libevent.h index 8ddb61b..0a27c4c 100644 --- a/net/socket/tcp_client_socket_libevent.h +++ b/net/socket/tcp_client_socket_libevent.h @@ -88,10 +88,7 @@ class NET_EXPORT_PRIVATE TCPClientSocketLibevent : public StreamSocket, // MessageLoopForIO::Watcher methods - virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE { - if (!socket_->read_callback_.is_null()) - socket_->DidCompleteRead(); - } + virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE; virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE {} @@ -107,13 +104,7 @@ class NET_EXPORT_PRIVATE TCPClientSocketLibevent : public StreamSocket, // MessageLoopForIO::Watcher implementation. virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE {} - virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE { - if (socket_->waiting_connect()) { - socket_->DidCompleteConnect(); - } else if (!socket_->write_callback_.is_null()) { - socket_->DidCompleteWrite(); - } - } + virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE; private: TCPClientSocketLibevent* const socket_; diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc index 43492b3..ce98982 100644 --- a/net/socket_stream/socket_stream.cc +++ b/net/socket_stream/socket_stream.cc @@ -44,6 +44,36 @@ static const int kReadBufferSize = 4096; namespace net { +int SocketStream::Delegate::OnStartOpenConnection( + SocketStream* socket, const CompletionCallback& callback) { + return OK; +} + +void SocketStream::Delegate::OnAuthRequired(SocketStream* socket, + AuthChallengeInfo* auth_info) { + // By default, no credential is available and close the connection. + socket->Close(); +} + +void SocketStream::Delegate::OnSSLCertificateError( + SocketStream* socket, + const SSLInfo& ssl_info, + bool fatal) { + socket->CancelWithSSLError(ssl_info); +} + +bool SocketStream::Delegate::CanGetCookies(SocketStream* socket, + const GURL& url) { + return true; +} + +bool SocketStream::Delegate::CanSetCookie(SocketStream* request, + const GURL& url, + const std::string& cookie_line, + CookieOptions* options) { + return true; +} + SocketStream::ResponseHeaders::ResponseHeaders() : IOBuffer() {} void SocketStream::ResponseHeaders::Realloc(size_t new_size) { @@ -273,6 +303,8 @@ SocketStream::~SocketStream() { DCHECK(!pac_request_); } +SocketStream::RequestHeaders::~RequestHeaders() { data_ = NULL; } + void SocketStream::set_addresses(const AddressList& addresses) { addresses_ = addresses; } diff --git a/net/socket_stream/socket_stream.h b/net/socket_stream/socket_stream.h index 2bc0ebe..5220e4c 100644 --- a/net/socket_stream/socket_stream.h +++ b/net/socket_stream/socket_stream.h @@ -60,9 +60,7 @@ class NET_EXPORT SocketStream class NET_EXPORT Delegate { public: virtual int OnStartOpenConnection(SocketStream* socket, - const CompletionCallback& callback) { - return OK; - } + const CompletionCallback& callback); // Called when socket stream has been connected. The socket stream accepts // at most |max_pending_send_allowed| so that a client of the socket stream @@ -86,19 +84,14 @@ class NET_EXPORT SocketStream // The delegate should call RestartWithAuth() if credential for |auth_info| // is found in password database, or call Close() to close the connection. virtual void OnAuthRequired(SocketStream* socket, - AuthChallengeInfo* auth_info) { - // By default, no credential is available and close the connection. - socket->Close(); - } + AuthChallengeInfo* auth_info); // Called when using SSL and the server responds with a certificate with an // error. The delegate should call CancelBecauseOfCertError() or // ContinueDespiteCertError() to resume connection handling. virtual void OnSSLCertificateError(SocketStream* socket, const SSLInfo& ssl_info, - bool fatal) { - socket->CancelWithSSLError(ssl_info); - } + bool fatal); // Called when an error occured. // This is only for error reporting to the delegate. @@ -107,18 +100,14 @@ class NET_EXPORT SocketStream // Called when reading cookies to allow the delegate to block access to the // cookie. - virtual bool CanGetCookies(SocketStream* socket, const GURL& url) { - return true; - } + virtual bool CanGetCookies(SocketStream* socket, const GURL& url); // Called when a cookie is set to allow the delegate to block access to the // cookie. virtual bool CanSetCookie(SocketStream* request, const GURL& url, const std::string& cookie_line, - CookieOptions* options) { - return true; - } + CookieOptions* options); protected: virtual ~Delegate() {} @@ -211,7 +200,7 @@ class NET_EXPORT SocketStream std::string headers_; private: - virtual ~RequestHeaders() { data_ = NULL; } + virtual ~RequestHeaders(); }; class ResponseHeaders : public IOBuffer { diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index 75497a5..2b73fcc 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -324,8 +324,26 @@ SpdySession::SpdySession(const HostPortProxyPair& host_port_proxy_pair, // TODO(mbelshe): consider randomization of the stream_hi_water_mark. } +SpdySession::PendingCreateStream::PendingCreateStream( + const GURL& url, RequestPriority priority, + scoped_refptr<SpdyStream>* spdy_stream, + const BoundNetLog& stream_net_log, + const CompletionCallback& callback) + : url(&url), + priority(priority), + spdy_stream(spdy_stream), + stream_net_log(&stream_net_log), + callback(callback) { +} + SpdySession::PendingCreateStream::~PendingCreateStream() {} +SpdySession::CallbackResultPair::CallbackResultPair( + const CompletionCallback& callback_in, int result_in) + : callback(callback_in), + result(result_in) { +} + SpdySession::CallbackResultPair::~CallbackResultPair() {} SpdySession::~SpdySession() { diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h index 579452e..b792470 100644 --- a/net/spdy/spdy_session.h +++ b/net/spdy/spdy_session.h @@ -374,13 +374,7 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, PendingCreateStream(const GURL& url, RequestPriority priority, scoped_refptr<SpdyStream>* spdy_stream, const BoundNetLog& stream_net_log, - const CompletionCallback& callback) - : url(&url), - priority(priority), - spdy_stream(spdy_stream), - stream_net_log(&stream_net_log), - callback(callback) { - } + const CompletionCallback& callback); ~PendingCreateStream(); @@ -411,8 +405,7 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, SpdyIOBufferProducerCompare> WriteQueue; struct CallbackResultPair { - CallbackResultPair(const CompletionCallback& callback_in, int result_in) - : callback(callback_in), result(result_in) {} + CallbackResultPair(const CompletionCallback& callback_in, int result_in); ~CallbackResultPair(); CompletionCallback callback; diff --git a/net/tools/flip_server/balsa_headers.cc b/net/tools/flip_server/balsa_headers.cc index 0fe68c2..0cba73b 100644 --- a/net/tools/flip_server/balsa_headers.cc +++ b/net/tools/flip_server/balsa_headers.cc @@ -70,10 +70,23 @@ namespace net { const size_t BalsaBuffer::kDefaultBlocksize; +BalsaHeaders::iterator_base::iterator_base() : headers_(NULL), idx_(0) { } + +BalsaHeaders::iterator_base::iterator_base(const iterator_base& it) + : headers_(it.headers_), + idx_(it.idx_) { +} + std::ostream& BalsaHeaders::iterator_base::operator<<(std::ostream& os) const { - os << "[" << this->headers_ << ", " << this->idx_ << "]"; - return os; - } + os << "[" << this->headers_ << ", " << this->idx_ << "]"; + return os; +} + +BalsaHeaders::iterator_base::iterator_base(const BalsaHeaders* headers, + HeaderLines::size_type index) + : headers_(headers), + idx_(index) { +} BalsaBuffer::~BalsaBuffer() { CleanupBlocksStartingFrom(0); @@ -225,6 +238,26 @@ void BalsaBuffer::CleanupBlocksStartingFrom(Blocks::size_type start_idx) { blocks_.resize(start_idx); } +BalsaHeaders::const_header_lines_key_iterator::const_header_lines_key_iterator( + const const_header_lines_key_iterator& other) + : iterator_base(other), + key_(other.key_) { +} + +BalsaHeaders::const_header_lines_key_iterator::const_header_lines_key_iterator( + const BalsaHeaders* headers, + HeaderLines::size_type index, + const base::StringPiece& key) + : iterator_base(headers, index), + key_(key) { +} + +BalsaHeaders::const_header_lines_key_iterator::const_header_lines_key_iterator( + const BalsaHeaders* headers, + HeaderLines::size_type index) + : iterator_base(headers, index) { +} + BalsaHeaders::BalsaHeaders() : balsa_buffer_(4096), content_length_(0), diff --git a/net/tools/flip_server/balsa_headers.h b/net/tools/flip_server/balsa_headers.h index 981b5a7..1bd3100 100644 --- a/net/tools/flip_server/balsa_headers.h +++ b/net/tools/flip_server/balsa_headers.h @@ -306,12 +306,10 @@ class BalsaHeaders { typedef iterator_base self; // default constructor. - iterator_base() : headers_(NULL), idx_(0) { } + iterator_base(); // copy constructor. - iterator_base(const iterator_base& it) - : headers_(it.headers_), - idx_(it.idx_) {} + iterator_base(const iterator_base& it); reference operator*() const { return Lookup(idx_); @@ -353,9 +351,7 @@ class BalsaHeaders { std::ostream& operator<<(std::ostream& os) const; protected: - iterator_base(const BalsaHeaders* headers, HeaderLines::size_type index) : - headers_(headers), - idx_(index) {} + iterator_base(const BalsaHeaders* headers, HeaderLines::size_type index); void increment() { const HeaderLines& header_lines = headers_->header_lines_; @@ -536,6 +532,7 @@ class BalsaHeaders { friend class BalsaHeaders; public: typedef const_header_lines_key_iterator self; + const_header_lines_key_iterator(const const_header_lines_key_iterator&); self& operator++() { do { @@ -554,16 +551,11 @@ class BalsaHeaders { private: const_header_lines_key_iterator(const BalsaHeaders* headers, HeaderLines::size_type index, - const base::StringPiece& key) - : iterator_base(headers, index), - key_(key) { - } + const base::StringPiece& key); // Should only be used for creating an end iterator. const_header_lines_key_iterator(const BalsaHeaders* headers, - HeaderLines::size_type index) - : iterator_base(headers, index) { - } + HeaderLines::size_type index); bool AtEnd() const { return *this >= headers_->header_lines_end(); diff --git a/net/tools/flip_server/output_ordering.cc b/net/tools/flip_server/output_ordering.cc index f5fb4cf..dd11962 100644 --- a/net/tools/flip_server/output_ordering.cc +++ b/net/tools/flip_server/output_ordering.cc @@ -10,6 +10,11 @@ namespace net { +OutputOrdering::PriorityMapPointer::PriorityMapPointer() + : ring(NULL), + alarm_enabled(false) { +} + // static double OutputOrdering::server_think_time_in_s_ = 0.0; @@ -176,4 +181,3 @@ void OutputOrdering::RemoveStreamId(uint32 stream_id) { } } // namespace net - diff --git a/net/tools/flip_server/output_ordering.h b/net/tools/flip_server/output_ordering.h index 5ece610..0558e3e4 100644 --- a/net/tools/flip_server/output_ordering.h +++ b/net/tools/flip_server/output_ordering.h @@ -25,7 +25,7 @@ class OutputOrdering { typedef std::map<uint32, PriorityRing> PriorityMap; struct PriorityMapPointer { - PriorityMapPointer(): ring(NULL), alarm_enabled(false) {} + PriorityMapPointer(); PriorityRing* ring; PriorityRing::iterator it; bool alarm_enabled; @@ -86,4 +86,3 @@ class OutputOrdering { } // namespace net #endif // NET_TOOLS_FLIP_SERVER_OUTPUT_ORDERING_H_ - diff --git a/net/udp/udp_socket_libevent.cc b/net/udp/udp_socket_libevent.cc index 3782db3..beb1dca 100644 --- a/net/udp/udp_socket_libevent.cc +++ b/net/udp/udp_socket_libevent.cc @@ -292,6 +292,16 @@ void UDPSocketLibevent::AllowBroadcast() { socket_options_ |= SOCKET_OPTION_BROADCAST; } +void UDPSocketLibevent::ReadWatcher::OnFileCanReadWithoutBlocking(int) { + if (!socket_->read_callback_.is_null()) + socket_->DidCompleteRead(); +} + +void UDPSocketLibevent::WriteWatcher::OnFileCanWriteWithoutBlocking(int) { + if (!socket_->write_callback_.is_null()) + socket_->DidCompleteWrite(); +} + void UDPSocketLibevent::DoReadCallback(int rv) { DCHECK_NE(rv, ERR_IO_PENDING); DCHECK(!read_callback_.is_null()); diff --git a/net/udp/udp_socket_libevent.h b/net/udp/udp_socket_libevent.h index 4d3cddd..ce8a0f2 100644 --- a/net/udp/udp_socket_libevent.h +++ b/net/udp/udp_socket_libevent.h @@ -127,10 +127,7 @@ class NET_EXPORT UDPSocketLibevent : public base::NonThreadSafe { // MessageLoopForIO::Watcher methods - virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE { - if (!socket_->read_callback_.is_null()) - socket_->DidCompleteRead(); - } + virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE; virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE {} @@ -148,10 +145,7 @@ class NET_EXPORT UDPSocketLibevent : public base::NonThreadSafe { virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE {} - virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE { - if (!socket_->write_callback_.is_null()) - socket_->DidCompleteWrite(); - } + virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE; private: UDPSocketLibevent* const socket_; diff --git a/net/url_request/url_request_job_factory.cc b/net/url_request/url_request_job_factory.cc index f5ff25d..44bc002 100644 --- a/net/url_request/url_request_job_factory.cc +++ b/net/url_request/url_request_job_factory.cc @@ -15,6 +15,11 @@ URLRequestJobFactory::ProtocolHandler::~ProtocolHandler() {} URLRequestJobFactory::Interceptor::~Interceptor() {} +bool URLRequestJobFactory::Interceptor::WillHandleProtocol( + const std::string& protocol) const { + return false; +} + URLRequestJobFactory::URLRequestJobFactory() {} URLRequestJobFactory::~URLRequestJobFactory() { diff --git a/net/url_request/url_request_job_factory.h b/net/url_request/url_request_job_factory.h index 2c0c41c..746e948 100644 --- a/net/url_request/url_request_job_factory.h +++ b/net/url_request/url_request_job_factory.h @@ -62,9 +62,7 @@ class NET_EXPORT URLRequestJobFactory // Returns true if this interceptor handles requests for URLs with the // given protocol. Returning false does not imply that this interceptor // can't or won't handle requests with the given protocol. - virtual bool WillHandleProtocol(const std::string& protocol) const { - return false; - } + virtual bool WillHandleProtocol(const std::string& protocol) const; }; URLRequestJobFactory(); |