diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 18:00:53 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 18:00:53 +0000 |
commit | 9349cfb12f1b27e30ebb5d4ffc994812cce26d59 (patch) | |
tree | c98a55495b06a5cd068c251d2e217cf89cef6c02 /net/http | |
parent | 1c77d22487ac4759f29d329be7493228671bc05f (diff) | |
download | chromium_src-9349cfb12f1b27e30ebb5d4ffc994812cce26d59.zip chromium_src-9349cfb12f1b27e30ebb5d4ffc994812cce26d59.tar.gz chromium_src-9349cfb12f1b27e30ebb5d4ffc994812cce26d59.tar.bz2 |
FBTF: A giant cleanup to net/
This moves all sorts of code from h files to cc files and reduces header
dependencies.
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/3212008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r-- | net/http/http_cache_transaction.cc | 1 | ||||
-rw-r--r-- | net/http/http_cache_unittest.cc | 1 | ||||
-rw-r--r-- | net/http/http_network_session.cc | 1 | ||||
-rw-r--r-- | net/http/http_network_transaction_unittest.cc | 6 | ||||
-rw-r--r-- | net/http/http_response_headers.cc | 6 | ||||
-rw-r--r-- | net/http/http_response_headers.h | 4 | ||||
-rw-r--r-- | net/http/http_response_info.cc | 1 | ||||
-rw-r--r-- | net/http/http_stream_handle.cc | 82 | ||||
-rw-r--r-- | net/http/http_stream_handle.h | 68 |
9 files changed, 115 insertions, 55 deletions
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc index 5632563..b7a56f6 100644 --- a/net/http/http_cache_transaction.cc +++ b/net/http/http_cache_transaction.cc @@ -18,6 +18,7 @@ #include "base/ref_counted.h" #include "base/string_util.h" #include "base/time.h" +#include "net/base/cert_status_flags.h" #include "net/base/io_buffer.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index b5704cd..86b5e0f 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc @@ -9,6 +9,7 @@ #include "base/scoped_vector.h" #include "base/string_util.h" #include "net/base/cache_type.h" +#include "net/base/cert_status_flags.h" #include "net/base/net_errors.h" #include "net/base/load_flags.h" #include "net/base/net_log_unittest.h" diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc index 718d2cd..9a563dc 100644 --- a/net/http/http_network_session.cc +++ b/net/http/http_network_session.cc @@ -9,6 +9,7 @@ #include "base/logging.h" #include "base/stl_util-inl.h" #include "base/string_util.h" +#include "base/values.h" #include "net/http/http_auth_handler_factory.h" #include "net/http/url_security_manager.h" #include "net/spdy/spdy_session_pool.h" diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 81c26fa..5d21eba 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -5245,7 +5245,7 @@ TEST_F(HttpNetworkTransactionTest, UploadFileSmallerThanLength) { element.SetToFilePath(temp_file_path); element.SetContentLength(kFakeSize); elements.push_back(element); - request.upload_data->set_elements(elements); + request.upload_data->SetElements(elements); EXPECT_EQ(kFakeSize, request.upload_data->GetContentLength()); MockRead data_reads[] = { @@ -5302,7 +5302,7 @@ TEST_F(HttpNetworkTransactionTest, UploadUnreadableFile) { UploadData::Element element; element.SetToFilePath(temp_file); elements.push_back(element); - request.upload_data->set_elements(elements); + request.upload_data->SetElements(elements); MockRead data_reads[] = { MockRead("HTTP/1.0 200 OK\r\n\r\n"), @@ -5357,7 +5357,7 @@ TEST_F(HttpNetworkTransactionTest, UnreadableUploadFileAfterAuthRestart) { UploadData::Element element; element.SetToFilePath(temp_file); elements.push_back(element); - request.upload_data->set_elements(elements); + request.upload_data->SetElements(elements); MockRead data_reads[] = { MockRead("HTTP/1.1 401 Unauthorized\r\n"), diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc index ba85ac72..631b3a1 100644 --- a/net/http/http_response_headers.cc +++ b/net/http/http_response_headers.cc @@ -494,6 +494,12 @@ bool HttpResponseHeaders::HasHeader(const std::string& name) const { return FindHeader(0, name) != std::string::npos; } +HttpResponseHeaders::HttpResponseHeaders() { +} + +HttpResponseHeaders::~HttpResponseHeaders() { +} + // Note: this implementation implicitly assumes that line_end points at a valid // sentinel character (such as '\0'). // static diff --git a/net/http/http_response_headers.h b/net/http/http_response_headers.h index 5d116f6..8e011f8 100644 --- a/net/http/http_response_headers.h +++ b/net/http/http_response_headers.h @@ -251,8 +251,8 @@ class HttpResponseHeaders typedef base::hash_set<std::string> HeaderSet; - HttpResponseHeaders() {} - ~HttpResponseHeaders() {} + HttpResponseHeaders(); + ~HttpResponseHeaders(); // Initializes from the given raw headers. void Parse(const std::string& raw_input); diff --git a/net/http/http_response_info.cc b/net/http/http_response_info.cc index a83a642..dc90d1f 100644 --- a/net/http/http_response_info.cc +++ b/net/http/http_response_info.cc @@ -11,6 +11,7 @@ #include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "net/base/ssl_cert_request_info.h" +#include "net/base/x509_certificate.h" #include "net/http/http_response_headers.h" using base::Time; diff --git a/net/http/http_stream_handle.cc b/net/http/http_stream_handle.cc new file mode 100644 index 0000000..d2ad0f0 --- /dev/null +++ b/net/http/http_stream_handle.cc @@ -0,0 +1,82 @@ +// Copyright (c) 2010 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. + +#include "net/http/http_stream_handle.h" + +namespace net { + +HttpStreamHandle::HttpStreamHandle(ClientSocketHandle* connection, + HttpStream* stream) + : connection_(connection), stream_(stream) { + DCHECK(stream_.get()); +} + +HttpStreamHandle::~HttpStreamHandle() { +} + +int HttpStreamHandle::InitializeStream(const HttpRequestInfo* request_info, + const BoundNetLog& net_log, + CompletionCallback* callback) { + return stream_->InitializeStream(request_info, net_log, callback); +} + +int HttpStreamHandle::SendRequest(const std::string& request_headers, + UploadDataStream* request_body, + HttpResponseInfo* response, + CompletionCallback* callback) { + return stream_->SendRequest(request_headers, request_body, response, + callback); +} + +uint64 HttpStreamHandle::GetUploadProgress() const { + return stream_->GetUploadProgress(); +} + +int HttpStreamHandle::ReadResponseHeaders(CompletionCallback* callback) { + return stream_->ReadResponseHeaders(callback); +} + +const HttpResponseInfo* HttpStreamHandle::GetResponseInfo() const { + return stream_->GetResponseInfo(); +} + +int HttpStreamHandle::ReadResponseBody(IOBuffer* buf, int buf_len, + CompletionCallback* callback) { + return stream_->ReadResponseBody(buf, buf_len, callback); +} + +void HttpStreamHandle::Close(bool not_reusable) { + stream_->Close(not_reusable); +} + +bool HttpStreamHandle::IsResponseBodyComplete() const { + return stream_->IsResponseBodyComplete(); +} + +bool HttpStreamHandle::CanFindEndOfResponse() const { + return stream_->CanFindEndOfResponse(); +} + +bool HttpStreamHandle::IsMoreDataBuffered() const { + return stream_->IsMoreDataBuffered(); +} + +bool HttpStreamHandle::IsConnectionReused() const { + return stream_->IsConnectionReused(); +} + +void HttpStreamHandle::SetConnectionReused() { + stream_->SetConnectionReused(); +} + +void HttpStreamHandle::GetSSLInfo(SSLInfo* ssl_info) { + stream_->GetSSLInfo(ssl_info); +} + +void HttpStreamHandle::GetSSLCertRequestInfo( + SSLCertRequestInfo* cert_request_info) { + stream_->GetSSLCertRequestInfo(cert_request_info); +} + +} // namespace net diff --git a/net/http/http_stream_handle.h b/net/http/http_stream_handle.h index 07e7d69..a328ff2 100644 --- a/net/http/http_stream_handle.h +++ b/net/http/http_stream_handle.h @@ -1,15 +1,15 @@ // Copyright (c) 2010 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. -// + #ifndef NET_HTTP_HTTP_STREAM_HANDLE_H_ #define NET_HTTP_HTTP_STREAM_HANDLE_H_ #pragma once #include <string> +#include "base/gtest_prod_util.h" #include "net/http/http_stream.h" - #include "net/socket/client_socket_handle.h" namespace net { @@ -23,77 +23,45 @@ struct HttpRequestInfo; // underlying ClientSocketHandle manually. class HttpStreamHandle : public HttpStream { public: - HttpStreamHandle(ClientSocketHandle* connection, HttpStream* stream) - : connection_(connection), stream_(stream) { - DCHECK(stream_.get()); - } - virtual ~HttpStreamHandle() {} + HttpStreamHandle(ClientSocketHandle* connection, HttpStream* stream); + virtual ~HttpStreamHandle(); HttpStream* stream() { return stream_.get(); } // HttpStream interface int InitializeStream(const HttpRequestInfo* request_info, const BoundNetLog& net_log, - CompletionCallback* callback) { - return stream_->InitializeStream(request_info, net_log, callback); - } + CompletionCallback* callback); int SendRequest(const std::string& request_headers, UploadDataStream* request_body, HttpResponseInfo* response, - CompletionCallback* callback) { - return stream_->SendRequest(request_headers, request_body, response, - callback); - } + CompletionCallback* callback); - uint64 GetUploadProgress() const { - return stream_->GetUploadProgress(); - } + uint64 GetUploadProgress() const; - int ReadResponseHeaders(CompletionCallback* callback) { - return stream_->ReadResponseHeaders(callback); - } + int ReadResponseHeaders(CompletionCallback* callback); - const HttpResponseInfo* GetResponseInfo() const { - return stream_->GetResponseInfo(); - } + const HttpResponseInfo* GetResponseInfo() const; int ReadResponseBody(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { - return stream_->ReadResponseBody(buf, buf_len, callback); - } + CompletionCallback* callback); - void Close(bool not_reusable) { - stream_->Close(not_reusable); - } + void Close(bool not_reusable); - bool IsResponseBodyComplete() const { - return stream_->IsResponseBodyComplete(); - } + bool IsResponseBodyComplete() const; - bool CanFindEndOfResponse() const { - return stream_->CanFindEndOfResponse(); - } + bool CanFindEndOfResponse() const; - bool IsMoreDataBuffered() const { - return stream_->IsMoreDataBuffered(); - } + bool IsMoreDataBuffered() const; - bool IsConnectionReused() const { - return stream_->IsConnectionReused(); - } + bool IsConnectionReused() const; - void SetConnectionReused() { - stream_->SetConnectionReused(); - } + void SetConnectionReused(); - void GetSSLInfo(SSLInfo* ssl_info) { - stream_->GetSSLInfo(ssl_info); - } + void GetSSLInfo(SSLInfo* ssl_info); - void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) { - stream_->GetSSLCertRequestInfo(cert_request_info); - } + void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); private: FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, WindowUpdateSent); |