diff options
author | vsevik@chromium.org <vsevik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-13 19:57:25 +0000 |
---|---|---|
committer | vsevik@chromium.org <vsevik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-13 19:57:25 +0000 |
commit | dfd68217f29368caff98a05afb06d86430cf7707 (patch) | |
tree | ca02da287323bf785e8ff719987737cc9b8845fe | |
parent | 41e889432dacf1044c38d23a49b7edbc44d273b6 (diff) | |
download | chromium_src-dfd68217f29368caff98a05afb06d86430cf7707.zip chromium_src-dfd68217f29368caff98a05afb06d86430cf7707.tar.gz chromium_src-dfd68217f29368caff98a05afb06d86430cf7707.tar.bz2 |
Renamed raw_data_length to encoded_data_length
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/6838021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81464 0039d316-1c4b-4281-b951-d872f2087c98
29 files changed, 109 insertions, 103 deletions
diff --git a/chrome/browser/debugger/devtools_netlog_observer.cc b/chrome/browser/debugger/devtools_netlog_observer.cc index 8789de2..f0fa8aa 100644 --- a/chrome/browser/debugger/devtools_netlog_observer.cc +++ b/chrome/browser/debugger/devtools_netlog_observer.cc @@ -83,20 +83,20 @@ void DevToolsNetLogObserver::OnAddURLRequestEntry( request_to_info_[source.id] = new ResourceInfo(); - if (request_to_raw_data_length_.size() > kMaxNumEntries) { - LOG(WARNING) << "The raw data length observer url request count has " - "grown larger than expected, resetting"; - request_to_raw_data_length_.clear(); + if (request_to_encoded_data_length_.size() > kMaxNumEntries) { + LOG(WARNING) << "The encoded data length observer url request count " + "has grown larger than expected, resetting"; + request_to_encoded_data_length_.clear(); } - request_to_raw_data_length_[source.id] = 0; + request_to_encoded_data_length_[source.id] = 0; } return; } else if (type == net::NetLog::TYPE_REQUEST_ALIVE) { // Cleanup records based on the TYPE_REQUEST_ALIVE entry. if (is_end) { request_to_info_.erase(source.id); - request_to_raw_data_length_.erase(source.id); + request_to_encoded_data_length_.erase(source.id); } return; } @@ -196,9 +196,9 @@ void DevToolsNetLogObserver::OnAddSocketEntry( return; } - RequestToRawDataLengthMap::iterator raw_data_length_it = - request_to_raw_data_length_.find(request_id); - if (raw_data_length_it == request_to_raw_data_length_.end()) + RequestToEncodedDataLengthMap::iterator encoded_data_length_it = + request_to_encoded_data_length_.find(request_id); + if (encoded_data_length_it == request_to_encoded_data_length_.end()) return; if (net::NetLog::TYPE_SOCKET_BYTES_RECEIVED == type) { @@ -211,7 +211,7 @@ void DevToolsNetLogObserver::OnAddSocketEntry( if (!dValue->GetInteger("byte_count", &byte_count)) return; - raw_data_length_it->second += byte_count; + encoded_data_length_it->second += byte_count; } } @@ -252,7 +252,7 @@ void DevToolsNetLogObserver::PopulateResponseInfo(net::URLRequest* request, } // static -int DevToolsNetLogObserver::GetAndResetRawDataLength( +int DevToolsNetLogObserver::GetAndResetEncodedDataLength( net::URLRequest* request) { if (!(request->load_flags() & net::LOAD_REPORT_RAW_HEADERS)) return -1; @@ -263,11 +263,12 @@ int DevToolsNetLogObserver::GetAndResetRawDataLength( if (dev_tools_net_log_observer == NULL) return -1; - RequestToRawDataLengthMap::iterator it = - dev_tools_net_log_observer->request_to_raw_data_length_.find(source_id); - if (it == dev_tools_net_log_observer->request_to_raw_data_length_.end()) + RequestToEncodedDataLengthMap::iterator it = + dev_tools_net_log_observer->request_to_encoded_data_length_.find( + source_id); + if (it == dev_tools_net_log_observer->request_to_encoded_data_length_.end()) return -1; - int raw_data_length = it->second; + int encoded_data_length = it->second; it->second = 0; - return raw_data_length; + return encoded_data_length; } diff --git a/chrome/browser/debugger/devtools_netlog_observer.h b/chrome/browser/debugger/devtools_netlog_observer.h index 830afca..2d0abf3 100644 --- a/chrome/browser/debugger/devtools_netlog_observer.h +++ b/chrome/browser/debugger/devtools_netlog_observer.h @@ -61,7 +61,7 @@ class DevToolsNetLogObserver: public ChromeNetLog::ThreadSafeObserver { // are active. static DevToolsNetLogObserver* GetInstance(); static void PopulateResponseInfo(net::URLRequest*, ResourceResponse*); - static int GetAndResetRawDataLength(net::URLRequest* request); + static int GetAndResetEncodedDataLength(net::URLRequest* request); private: static DevToolsNetLogObserver* instance_; @@ -73,11 +73,11 @@ class DevToolsNetLogObserver: public ChromeNetLog::ThreadSafeObserver { ChromeNetLog* chrome_net_log_; typedef base::hash_map<uint32, scoped_refptr<ResourceInfo> > RequestToInfoMap; - typedef base::hash_map<uint32, int> RequestToRawDataLengthMap; + typedef base::hash_map<uint32, int> RequestToEncodedDataLengthMap; typedef base::hash_map<uint32, uint32> HTTPStreamJobToSocketMap; typedef base::hash_map<uint32, uint32> SocketToRequestMap; RequestToInfoMap request_to_info_; - RequestToRawDataLengthMap request_to_raw_data_length_; + RequestToEncodedDataLengthMap request_to_encoded_data_length_; HTTPStreamJobToSocketMap http_stream_job_to_socket_; SocketToRequestMap socket_to_request_; diff --git a/chrome/common/extensions/extension_localization_peer.cc b/chrome/common/extensions/extension_localization_peer.cc index 4bfb0d6..dfb4f1d 100644 --- a/chrome/common/extensions/extension_localization_peer.cc +++ b/chrome/common/extensions/extension_localization_peer.cc @@ -61,7 +61,7 @@ void ExtensionLocalizationPeer::OnReceivedResponse( void ExtensionLocalizationPeer::OnReceivedData(const char* data, int data_length, - int raw_data_length) { + int encoded_data_length) { data_.append(data, data_length); } diff --git a/chrome/common/extensions/extension_localization_peer.h b/chrome/common/extensions/extension_localization_peer.h index ad168fd..0a33bc9 100644 --- a/chrome/common/extensions/extension_localization_peer.h +++ b/chrome/common/extensions/extension_localization_peer.h @@ -41,7 +41,7 @@ class ExtensionLocalizationPeer virtual void OnDownloadedData(int len) {} virtual void OnReceivedData(const char* data, int data_length, - int raw_data_length); + int encoded_data_length); virtual void OnCompletedRequest(const net::URLRequestStatus& status, const std::string& security_info, const base::Time& completion_time); diff --git a/chrome/common/extensions/extension_localization_peer_unittest.cc b/chrome/common/extensions/extension_localization_peer_unittest.cc index 15aec31..df847ce 100644 --- a/chrome/common/extensions/extension_localization_peer_unittest.cc +++ b/chrome/common/extensions/extension_localization_peer_unittest.cc @@ -66,8 +66,9 @@ class MockResourceLoaderBridgePeer MOCK_METHOD1(OnReceivedResponse, void( const webkit_glue::ResourceResponseInfo& info)); MOCK_METHOD1(OnDownloadedData, void(int len)); - MOCK_METHOD3(OnReceivedData, - void(const char* data, int data_length, int raw_data_length)); + MOCK_METHOD3(OnReceivedData, void(const char* data, + int data_length, + int encoded_data_length)); MOCK_METHOD3(OnCompletedRequest, void( const net::URLRequestStatus& status, const std::string& security_info, diff --git a/chrome/renderer/security_filter_peer.cc b/chrome/renderer/security_filter_peer.cc index fd857a1..88a1091 100644 --- a/chrome/renderer/security_filter_peer.cc +++ b/chrome/renderer/security_filter_peer.cc @@ -81,7 +81,7 @@ void SecurityFilterPeer::OnReceivedResponse( void SecurityFilterPeer::OnReceivedData(const char* data, int data_length, - int raw_data_length) { + int encoded_data_length) { NOTREACHED(); } @@ -141,7 +141,7 @@ void BufferedPeer::OnReceivedResponse( void BufferedPeer::OnReceivedData(const char* data, int data_length, - int raw_data_length) { + int encoded_data_length) { data_.append(data, data_length); } @@ -192,7 +192,7 @@ void ReplaceContentPeer::OnReceivedResponse( void ReplaceContentPeer::OnReceivedData(const char* data, int data_length, - int raw_data_length) { + int encoded_data_length) { // Ignore this, we'll serve some alternate content in OnCompletedRequest. } diff --git a/chrome/renderer/security_filter_peer.h b/chrome/renderer/security_filter_peer.h index e1764b7..7095d76 100644 --- a/chrome/renderer/security_filter_peer.h +++ b/chrome/renderer/security_filter_peer.h @@ -40,7 +40,7 @@ class SecurityFilterPeer : public webkit_glue::ResourceLoaderBridge::Peer { virtual void OnDownloadedData(int len) {} virtual void OnReceivedData(const char* data, int data_length, - int raw_data_length); + int encoded_data_length); virtual void OnCompletedRequest(const net::URLRequestStatus& status, const std::string& security_info, const base::Time& completion_time); @@ -70,7 +70,7 @@ class BufferedPeer : public SecurityFilterPeer { const webkit_glue::ResourceResponseInfo& info); virtual void OnReceivedData(const char* data, int data_length, - int raw_data_length); + int encoded_data_length); virtual void OnCompletedRequest(const net::URLRequestStatus& status, const std::string& security_info, const base::Time& completion_time); @@ -112,7 +112,7 @@ class ReplaceContentPeer : public SecurityFilterPeer { const webkit_glue::ResourceResponseInfo& info); virtual void OnReceivedData(const char* data, int data_length, - int raw_data_length); + int encoded_data_length); virtual void OnCompletedRequest(const net::URLRequestStatus& status, const std::string& security_info, const base::Time& completion_time); diff --git a/content/browser/renderer_host/async_resource_handler.cc b/content/browser/renderer_host/async_resource_handler.cc index d8ac365..c975903 100644 --- a/content/browser/renderer_host/async_resource_handler.cc +++ b/content/browser/renderer_host/async_resource_handler.cc @@ -218,10 +218,10 @@ bool AsyncResourceHandler::OnReadCompleted(int request_id, int* bytes_read) { net::URLRequest* request = rdh_->GetURLRequest( GlobalRequestID(filter_->child_id(), request_id)); - int raw_data_length = - DevToolsNetLogObserver::GetAndResetRawDataLength(request); + int encoded_data_length = + DevToolsNetLogObserver::GetAndResetEncodedDataLength(request); filter_->Send(new ResourceMsg_DataReceived( - routing_id_, request_id, handle, *bytes_read, raw_data_length)); + routing_id_, request_id, handle, *bytes_read, encoded_data_length)); return true; } diff --git a/content/browser/renderer_host/sync_resource_handler.cc b/content/browser/renderer_host/sync_resource_handler.cc index b474cf6..a5d3418 100644 --- a/content/browser/renderer_host/sync_resource_handler.cc +++ b/content/browser/renderer_host/sync_resource_handler.cc @@ -105,8 +105,8 @@ bool SyncResourceHandler::OnResponseCompleted( net::URLRequest* request = rdh_->GetURLRequest( GlobalRequestID(filter_->child_id(), request_id)); - result_.raw_data_length = - DevToolsNetLogObserver::GetAndResetRawDataLength(request); + result_.encoded_data_length = + DevToolsNetLogObserver::GetAndResetEncodedDataLength(request); ResourceHostMsg_SyncLoad::WriteReplyParams(result_message_, result_); filter_->Send(result_message_); diff --git a/content/common/resource_dispatcher.cc b/content/common/resource_dispatcher.cc index 9ed50bd..e72de05 100644 --- a/content/common/resource_dispatcher.cc +++ b/content/common/resource_dispatcher.cc @@ -212,7 +212,7 @@ void IPCResourceLoaderBridge::SyncLoad(SyncLoadResponse* response) { response->charset = result.charset; response->request_time = result.request_time; response->response_time = result.response_time; - response->raw_data_length = result.raw_data_length; + response->encoded_data_length = result.encoded_data_length; response->connection_id = result.connection_id; response->connection_reused = result.connection_reused; response->load_timing = result.load_timing; @@ -338,7 +338,7 @@ void ResourceDispatcher::OnReceivedData(const IPC::Message& message, int request_id, base::SharedMemoryHandle shm_handle, int data_len, - int raw_data_length) { + int encoded_data_length) { // Acknowledge the reception of this data. message_sender()->Send( new ResourceHostMsg_DataReceived_ACK(message.routing_id(), request_id)); @@ -353,7 +353,7 @@ void ResourceDispatcher::OnReceivedData(const IPC::Message& message, if (data_len > 0 && shared_mem.Map(data_len)) { const char* data = static_cast<char*>(shared_mem.memory()); - request_info->peer->OnReceivedData(data, data_len, raw_data_length); + request_info->peer->OnReceivedData(data, data_len, encoded_data_length); } } diff --git a/content/common/resource_dispatcher.h b/content/common/resource_dispatcher.h index efe4514..8317774 100644 --- a/content/common/resource_dispatcher.h +++ b/content/common/resource_dispatcher.h @@ -127,7 +127,7 @@ class ResourceDispatcher : public IPC::Channel::Listener { int request_id, base::SharedMemoryHandle data, int data_len, - int raw_data_length); + int encoded_data_length); void OnDownloadedData( const IPC::Message& message, int request_id, diff --git a/content/common/resource_dispatcher_unittest.cc b/content/common/resource_dispatcher_unittest.cc index 0236262..c566f76 100644 --- a/content/common/resource_dispatcher_unittest.cc +++ b/content/common/resource_dispatcher_unittest.cc @@ -58,10 +58,10 @@ class TestRequestCallback : public ResourceLoaderBridge::Peer { virtual void OnReceivedData(const char* data, int data_length, - int raw_data_length) { + int encoded_data_length) { EXPECT_FALSE(complete_); data_.append(data, data_length); - total_raw_data_length_ += raw_data_length; + total_encoded_data_length_ += encoded_data_length; } virtual void OnCompletedRequest(const net::URLRequestStatus& status, @@ -77,14 +77,14 @@ class TestRequestCallback : public ResourceLoaderBridge::Peer { const std::string& data() const { return data_; } - int total_raw_data_length() const { - return total_raw_data_length_; + int total_encoded_data_length() const { + return total_encoded_data_length_; } private: bool complete_; std::string data_; - int total_raw_data_length_; + int total_encoded_data_length_; }; @@ -194,7 +194,7 @@ TEST_F(ResourceDispatcherTest, RoundTrip) { // and dispatched, uncomment this. //EXPECT_TRUE(callback.complete()); //EXPECT_STREQ(test_page_contents, callback.data().c_str()); - //EXPECT_EQ(test_page_contents_len, callback.total_raw_data_length()); + //EXPECT_EQ(test_page_contents_len, callback.total_encoded_data_length()); delete bridge; } @@ -286,7 +286,7 @@ class DeferredResourceLoadingTest : public ResourceDispatcherTest, virtual void OnReceivedData(const char* data, int data_length, - int raw_data_length) { + int encoded_data_length) { EXPECT_EQ(defer_loading_, false); set_defer_loading(false); } diff --git a/content/common/resource_messages.h b/content/common/resource_messages.h index 5e6874a..1d1d51b 100644 --- a/content/common/resource_messages.h +++ b/content/common/resource_messages.h @@ -20,7 +20,7 @@ IPC_STRUCT_TRAITS_BEGIN(webkit_glue::ResourceResponseInfo) IPC_STRUCT_TRAITS_MEMBER(charset) IPC_STRUCT_TRAITS_MEMBER(security_info) IPC_STRUCT_TRAITS_MEMBER(content_length) - IPC_STRUCT_TRAITS_MEMBER(raw_data_length) + IPC_STRUCT_TRAITS_MEMBER(encoded_data_length) IPC_STRUCT_TRAITS_MEMBER(appcache_id) IPC_STRUCT_TRAITS_MEMBER(appcache_manifest_url) IPC_STRUCT_TRAITS_MEMBER(connection_id) @@ -126,7 +126,7 @@ IPC_MESSAGE_ROUTED4(ResourceMsg_DataReceived, int /* request_id */, base::SharedMemoryHandle /* data */, int /* data_len */, - int /* raw_data_length */) + int /* encoded_data_length */) // Sent when some data from a resource request has been downloaded to // file. This is only called in the 'download_to_file' case and replaces diff --git a/webkit/glue/media/buffered_resource_loader.cc b/webkit/glue/media/buffered_resource_loader.cc index 4eefe16..0c54fad 100644 --- a/webkit/glue/media/buffered_resource_loader.cc +++ b/webkit/glue/media/buffered_resource_loader.cc @@ -322,7 +322,7 @@ void BufferedResourceLoader::didReceiveData( WebURLLoader* loader, const char* data, int data_length, - int raw_data_length) { + int encoded_data_length) { DCHECK(!completed_); DCHECK_GT(data_length, 0); diff --git a/webkit/glue/media/buffered_resource_loader.h b/webkit/glue/media/buffered_resource_loader.h index 52513e8..9e0c870 100644 --- a/webkit/glue/media/buffered_resource_loader.h +++ b/webkit/glue/media/buffered_resource_loader.h @@ -135,7 +135,7 @@ class BufferedResourceLoader : WebKit::WebURLLoader* loader, const char* data, int data_length, - int raw_data_length); + int encoded_data_length); virtual void didReceiveCachedMetadata( WebKit::WebURLLoader* loader, const char* data, int dataLength); diff --git a/webkit/glue/media/simple_data_source.cc b/webkit/glue/media/simple_data_source.cc index 45befa0..6647e52 100644 --- a/webkit/glue/media/simple_data_source.cc +++ b/webkit/glue/media/simple_data_source.cc @@ -184,7 +184,7 @@ void SimpleDataSource::didReceiveData( WebKit::WebURLLoader* loader, const char* data, int data_length, - int raw_data_length) { + int encoded_data_length) { DCHECK(MessageLoop::current() == render_loop_); data_.append(data, data_length); } diff --git a/webkit/glue/media/simple_data_source.h b/webkit/glue/media/simple_data_source.h index 3993f3b..2c4075af 100644 --- a/webkit/glue/media/simple_data_source.h +++ b/webkit/glue/media/simple_data_source.h @@ -75,7 +75,7 @@ class SimpleDataSource : public WebDataSource, WebKit::WebURLLoader* loader, const char* data, int dataLength, - int rawDataLength); + int encodedDataLength); virtual void didReceiveCachedMetadata( WebKit::WebURLLoader* loader, const char* data, int dataLength); diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc index f45ec0f..3a4f053 100644 --- a/webkit/glue/multipart_response_delegate.cc +++ b/webkit/glue/multipart_response_delegate.cc @@ -62,7 +62,7 @@ MultipartResponseDelegate::MultipartResponseDelegate( : client_(client), loader_(loader), original_response_(response), - raw_data_length_(0), + encoded_data_length_(0), boundary_("--"), first_received_data_(true), processing_headers_(false), @@ -78,7 +78,7 @@ MultipartResponseDelegate::MultipartResponseDelegate( void MultipartResponseDelegate::OnReceivedData(const char* data, int data_len, - int raw_data_length) { + int encoded_data_length) { // stop_sending_ means that we've already received the final boundary token. // The server should stop sending us data at this point, but if it does, we // just throw it away. @@ -86,7 +86,7 @@ void MultipartResponseDelegate::OnReceivedData(const char* data, return; data_.append(data, data_len); - raw_data_length_ += raw_data_length; + encoded_data_length_ += encoded_data_length; if (first_received_data_) { // Some servers don't send a boundary token before the first chunk of // data. We handle this case anyway (Gecko does too). @@ -144,8 +144,8 @@ void MultipartResponseDelegate::OnReceivedData(const char* data, client_->didReceiveData(loader_, data_.data(), static_cast<int>(data_length), - raw_data_length_); - raw_data_length_ = 0; + encoded_data_length_); + encoded_data_length_ = 0; } } size_t boundary_end_pos = boundary_pos + boundary_.length(); @@ -179,9 +179,9 @@ void MultipartResponseDelegate::OnReceivedData(const char* data, client_->didReceiveData(loader_, data_.data(), send_length, - raw_data_length_); + encoded_data_length_); data_ = data_.substr(send_length); - raw_data_length_ = 0; + encoded_data_length_ = 0; } } @@ -192,8 +192,8 @@ void MultipartResponseDelegate::OnCompletedRequest() { client_->didReceiveData(loader_, data_.data(), static_cast<int>(data_.length()), - raw_data_length_); - raw_data_length_ = 0; + encoded_data_length_); + encoded_data_length_ = 0; } } diff --git a/webkit/glue/multipart_response_delegate.h b/webkit/glue/multipart_response_delegate.h index 7c82958..5536d516 100644 --- a/webkit/glue/multipart_response_delegate.h +++ b/webkit/glue/multipart_response_delegate.h @@ -72,7 +72,7 @@ class MultipartResponseDelegate { const std::string& boundary); // Passed through from ResourceHandleInternal - void OnReceivedData(const char* data, int data_len, int raw_data_length); + void OnReceivedData(const char* data, int data_len, int encoded_data_length); void OnCompletedRequest(); // The request has been canceled, so stop making calls to the client. @@ -121,7 +121,7 @@ class MultipartResponseDelegate { size_t FindBoundary(); // Transferred data size accumulated between client callbacks. - int raw_data_length_; + int encoded_data_length_; // A temporary buffer to hold data between reads for multipart data that // gets split in the middle of a header. diff --git a/webkit/glue/multipart_response_delegate_unittest.cc b/webkit/glue/multipart_response_delegate_unittest.cc index 0aba6e9..bebb9f0 100644 --- a/webkit/glue/multipart_response_delegate_unittest.cc +++ b/webkit/glue/multipart_response_delegate_unittest.cc @@ -70,16 +70,16 @@ class MockWebURLLoaderClient : public WebURLLoaderClient { WebKit::WebURLLoader* loader, const char* data, int data_length, - int raw_data_length) { + int encoded_data_length) { ++received_data_; data_.append(data, data_length); - total_raw_data_length_ += raw_data_length; + total_encoded_data_length_ += encoded_data_length; } virtual void didFinishLoading(WebURLLoader*, double finishTime) {} virtual void didFail(WebURLLoader*, const WebURLError&) {} void Reset() { - received_response_ = received_data_ = total_raw_data_length_ = 0; + received_response_ = received_data_ = total_encoded_data_length_ = 0; data_.clear(); response_.reset(); } @@ -88,7 +88,7 @@ class MockWebURLLoaderClient : public WebURLLoaderClient { return string(response_.httpHeaderField(WebString::fromUTF8(name)).utf8()); } - int received_response_, received_data_, total_raw_data_length_; + int received_response_, received_data_, total_encoded_data_length_; string data_; WebURLResponse response_; }; @@ -223,7 +223,7 @@ TEST(MultipartResponseTest, MissingBoundaries) { EXPECT_EQ(1, client.received_data_); EXPECT_EQ(string("This is a sample response"), client.data_); EXPECT_EQ(static_cast<int>(no_start_boundary.length()), - client.total_raw_data_length_); + client.total_encoded_data_length_); delegate.OnCompletedRequest(); EXPECT_EQ(1, client.received_response_); @@ -242,14 +242,14 @@ TEST(MultipartResponseTest, MissingBoundaries) { EXPECT_EQ(1, client.received_data_); EXPECT_EQ("This is a sample response\n", client.data_); EXPECT_EQ(static_cast<int>(no_end_boundary.length()), - client.total_raw_data_length_); + client.total_encoded_data_length_); delegate2.OnCompletedRequest(); EXPECT_EQ(1, client.received_response_); EXPECT_EQ(1, client.received_data_); EXPECT_EQ(string("This is a sample response\n"), client.data_); EXPECT_EQ(static_cast<int>(no_end_boundary.length()), - client.total_raw_data_length_); + client.total_encoded_data_length_); // Neither boundary client.Reset(); @@ -264,14 +264,14 @@ TEST(MultipartResponseTest, MissingBoundaries) { EXPECT_EQ(1, client.received_data_); EXPECT_EQ("This is a sample response\n", client.data_); EXPECT_EQ(static_cast<int>(no_boundaries.length()), - client.total_raw_data_length_); + client.total_encoded_data_length_); delegate3.OnCompletedRequest(); EXPECT_EQ(1, client.received_response_); EXPECT_EQ(1, client.received_data_); EXPECT_EQ(string("This is a sample response\n"), client.data_); EXPECT_EQ(static_cast<int>(no_boundaries.length()), - client.total_raw_data_length_); + client.total_encoded_data_length_); } TEST(MultipartResponseTest, MalformedBoundary) { @@ -297,7 +297,7 @@ TEST(MultipartResponseTest, MalformedBoundary) { EXPECT_EQ(1, client.received_response_); EXPECT_EQ(1, client.received_data_); EXPECT_EQ(string("This is a sample response"), client.data_); - EXPECT_EQ(static_cast<int>(data.length()), client.total_raw_data_length_); + EXPECT_EQ(static_cast<int>(data.length()), client.total_encoded_data_length_); delegate.OnCompletedRequest(); EXPECT_EQ(1, client.received_response_); @@ -312,13 +312,13 @@ struct TestChunk { const int expected_responses; const int expected_received_data; const char* expected_data; - const int expected_raw_data_length; + const int expected_encoded_data_length; }; void VariousChunkSizesTest(const TestChunk chunks[], int chunks_size, int responses, int received_data, const char* completed_data, - int completed_raw_data_length) { + int completed_encoded_data_length) { const string data( "--bound\n" // 0-7 "Content-type: image/png\n\n" // 8-32 @@ -345,8 +345,8 @@ void VariousChunkSizesTest(const TestChunk chunks[], int chunks_size, EXPECT_EQ(chunks[i].expected_responses, client.received_response_); EXPECT_EQ(chunks[i].expected_received_data, client.received_data_); EXPECT_EQ(string(chunks[i].expected_data), client.data_); - EXPECT_EQ(chunks[i].expected_raw_data_length, - client.total_raw_data_length_); + EXPECT_EQ(chunks[i].expected_encoded_data_length, + client.total_encoded_data_length_); } // Check final state delegate.OnCompletedRequest(); @@ -354,7 +354,7 @@ void VariousChunkSizesTest(const TestChunk chunks[], int chunks_size, EXPECT_EQ(received_data, client.received_data_); string completed_data_string(completed_data); EXPECT_EQ(completed_data_string, client.data_); - EXPECT_EQ(completed_raw_data_length, client.total_raw_data_length_); + EXPECT_EQ(completed_encoded_data_length, client.total_encoded_data_length_); } TEST(MultipartResponseTest, BreakInBoundary) { @@ -462,7 +462,7 @@ TEST(MultipartResponseTest, SmallChunk) { EXPECT_EQ(4, client.received_response_); EXPECT_EQ(2, client.received_data_); EXPECT_EQ(string("end"), client.data_); - EXPECT_EQ(static_cast<int>(data.length()), client.total_raw_data_length_); + EXPECT_EQ(static_cast<int>(data.length()), client.total_encoded_data_length_); delegate.OnCompletedRequest(); EXPECT_EQ(4, client.received_response_); @@ -484,7 +484,7 @@ TEST(MultipartResponseTest, MultipleBoundaries) { EXPECT_EQ(2, client.received_response_); EXPECT_EQ(1, client.received_data_); EXPECT_EQ(string("foofoo"), client.data_); - EXPECT_EQ(static_cast<int>(data.length()), client.total_raw_data_length_); + EXPECT_EQ(static_cast<int>(data.length()), client.total_encoded_data_length_); } TEST(MultipartResponseTest, MultipartByteRangeParsingTest) { @@ -652,7 +652,7 @@ TEST(MultipartResponseTest, MultipartPayloadSet) { static_cast<int>(data.length())); EXPECT_EQ(1, client.received_response_); EXPECT_EQ(string("response data"), client.data_); - EXPECT_EQ(static_cast<int>(data.length()), client.total_raw_data_length_); + EXPECT_EQ(static_cast<int>(data.length()), client.total_encoded_data_length_); EXPECT_FALSE(client.response_.isMultipartPayload()); string data2( @@ -665,7 +665,7 @@ TEST(MultipartResponseTest, MultipartPayloadSet) { EXPECT_EQ(2, client.received_response_); EXPECT_EQ(string("response data2"), client.data_); EXPECT_EQ(static_cast<int>(data.length()) + static_cast<int>(data2.length()), - client.total_raw_data_length_); + client.total_encoded_data_length_); EXPECT_TRUE(client.response_.isMultipartPayload()); } diff --git a/webkit/glue/resource_fetcher.cc b/webkit/glue/resource_fetcher.cc index 2b3d47f..28885b4 100644 --- a/webkit/glue/resource_fetcher.cc +++ b/webkit/glue/resource_fetcher.cc @@ -89,7 +89,7 @@ void ResourceFetcher::didReceiveResponse( void ResourceFetcher::didReceiveData( WebURLLoader* loader, const char* data, int data_length, - int raw_data_length) { + int encoded_data_length) { DCHECK(!completed_); DCHECK(data_length > 0); diff --git a/webkit/glue/resource_fetcher.h b/webkit/glue/resource_fetcher.h index 1fba6d7..6af9b54 100644 --- a/webkit/glue/resource_fetcher.h +++ b/webkit/glue/resource_fetcher.h @@ -67,7 +67,7 @@ class ResourceFetcher : public WebKit::WebURLLoaderClient { virtual void didReceiveData( WebKit::WebURLLoader* loader, const char* data, int data_length, - int raw_data_length); + int encoded_data_length); virtual void didFinishLoading( WebKit::WebURLLoader* loader, double finishTime); virtual void didFail( diff --git a/webkit/glue/resource_loader_bridge.cc b/webkit/glue/resource_loader_bridge.cc index ab757df..4cc012d 100644 --- a/webkit/glue/resource_loader_bridge.cc +++ b/webkit/glue/resource_loader_bridge.cc @@ -35,7 +35,7 @@ ResourceDevToolsInfo::~ResourceDevToolsInfo() {} ResourceResponseInfo::ResourceResponseInfo() : content_length(-1), - raw_data_length(-1), + encoded_data_length(-1), appcache_id(appcache::kNoCacheId), connection_id(0), connection_reused(false), diff --git a/webkit/glue/resource_loader_bridge.h b/webkit/glue/resource_loader_bridge.h index df55897..e1a5a99 100644 --- a/webkit/glue/resource_loader_bridge.h +++ b/webkit/glue/resource_loader_bridge.h @@ -141,9 +141,9 @@ struct ResourceResponseInfo { // Content length if available. -1 if not available int64 content_length; - // Length of the raw data transferred over the network. In case there is no - // data, contains -1. - int64 raw_data_length; + // Length of the encoded data transferred over the network. In case there is + // no data, contains -1. + int64 encoded_data_length; // The appcache this response was loaded from, or kNoCacheId. int64 appcache_id; @@ -305,12 +305,12 @@ class ResourceLoaderBridge { // Called when a chunk of response data is available. This method may // be called multiple times or not at all if an error occurs. - // The raw_data_length is the length of the raw data transferred over the - // network, which could be different from data length (e.g. for gzipped - // content), or -1 if if unknown. + // The encoded_data_length is the length of the encoded data transferred + // over the network, which could be different from data length (e.g. for + // gzipped content), or -1 if if unknown. virtual void OnReceivedData(const char* data, int data_length, - int raw_data_length) = 0; + int encoded_data_length) = 0; // Called when metadata generated by the renderer is retrieved from the // cache. This method may be called zero or one times. diff --git a/webkit/glue/weburlloader_impl.cc b/webkit/glue/weburlloader_impl.cc index bb7bf68..96042dc 100644 --- a/webkit/glue/weburlloader_impl.cc +++ b/webkit/glue/weburlloader_impl.cc @@ -159,7 +159,7 @@ bool GetInfoFromDataURL(const GURL& url, info->charset.swap(charset); info->security_info.clear(); info->content_length = -1; - info->raw_data_length = 0; + info->encoded_data_length = 0; info->load_timing.base_time = Time::Now(); return true; @@ -300,7 +300,7 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>, virtual void OnDownloadedData(int len); virtual void OnReceivedData(const char* data, int data_length, - int raw_data_length); + int encoded_data_length); virtual void OnReceivedCachedMetadata(const char* data, int len); virtual void OnCompletedRequest(const net::URLRequestStatus& status, const std::string& security_info, @@ -598,7 +598,7 @@ void WebURLLoaderImpl::Context::OnDownloadedData(int len) { void WebURLLoaderImpl::Context::OnReceivedData(const char* data, int data_length, - int raw_data_length) { + int encoded_data_length) { if (!client_) return; @@ -612,9 +612,9 @@ void WebURLLoaderImpl::Context::OnReceivedData(const char* data, } else if (multipart_delegate_.get()) { // The multipart delegate will make the appropriate calls to // client_->didReceiveData and client_->didReceiveResponse. - multipart_delegate_->OnReceivedData(data, data_length, raw_data_length); + multipart_delegate_->OnReceivedData(data, data_length, encoded_data_length); } else { - client_->didReceiveData(loader_, data, data_length, raw_data_length); + client_->didReceiveData(loader_, data, data_length, encoded_data_length); } } diff --git a/webkit/plugins/npapi/webplugin_impl.cc b/webkit/plugins/npapi/webplugin_impl.cc index aafcc76..687809f 100644 --- a/webkit/plugins/npapi/webplugin_impl.cc +++ b/webkit/plugins/npapi/webplugin_impl.cc @@ -110,8 +110,10 @@ class MultiPartResponseClient : public WebURLLoaderClient { } // Receives individual part data from a multipart response. - virtual void didReceiveData( - WebURLLoader*, const char* data, int data_length, int raw_data_length) { + virtual void didReceiveData(WebURLLoader*, + const char* data, + int data_length, + int encoded_data_length) { // TODO(ananta) // We should defer further loads on multipart resources on the same lines // as regular resources requested by plugins to prevent reentrancy. @@ -952,7 +954,7 @@ void WebPluginImpl::didReceiveResponse(WebURLLoader* loader, void WebPluginImpl::didReceiveData(WebURLLoader* loader, const char *buffer, int data_length, - int raw_data_length) { + int encoded_data_length) { WebPluginResourceClient* client = GetClientFromLoader(loader); if (!client) return; @@ -962,7 +964,9 @@ void WebPluginImpl::didReceiveData(WebURLLoader* loader, if (index != multi_part_response_map_.end()) { MultipartResponseDelegate* multi_part_handler = (*index).second; DCHECK(multi_part_handler != NULL); - multi_part_handler->OnReceivedData(buffer, data_length, raw_data_length); + multi_part_handler->OnReceivedData(buffer, + data_length, + encoded_data_length); } else { loader->setDefersLoading(true); client->DidReceiveData(buffer, data_length, 0); diff --git a/webkit/plugins/npapi/webplugin_impl.h b/webkit/plugins/npapi/webplugin_impl.h index 966dc0e..097296b 100644 --- a/webkit/plugins/npapi/webplugin_impl.h +++ b/webkit/plugins/npapi/webplugin_impl.h @@ -205,7 +205,7 @@ class WebPluginImpl : public WebPlugin, const WebKit::WebURLResponse& response); virtual void didReceiveData(WebKit::WebURLLoader* loader, const char *buffer, - int data_length, int raw_data_length); + int data_length, int encoded_data_length); virtual void didFinishLoading(WebKit::WebURLLoader* loader, double finishTime); virtual void didFail(WebKit::WebURLLoader* loader, diff --git a/webkit/plugins/ppapi/ppb_url_loader_impl.cc b/webkit/plugins/ppapi/ppb_url_loader_impl.cc index bb2621e..1c2323e 100644 --- a/webkit/plugins/ppapi/ppb_url_loader_impl.cc +++ b/webkit/plugins/ppapi/ppb_url_loader_impl.cc @@ -423,7 +423,7 @@ void PPB_URLLoader_Impl::didDownloadData(WebURLLoader* loader, void PPB_URLLoader_Impl::didReceiveData(WebURLLoader* loader, const char* data, int data_length, - int raw_data_length) { + int encoded_data_length) { bytes_received_ += data_length; buffer_.insert(buffer_.end(), data, data + data_length); diff --git a/webkit/plugins/ppapi/ppb_url_loader_impl.h b/webkit/plugins/ppapi/ppb_url_loader_impl.h index 3bc8dc1..6456900 100644 --- a/webkit/plugins/ppapi/ppb_url_loader_impl.h +++ b/webkit/plugins/ppapi/ppb_url_loader_impl.h @@ -80,7 +80,7 @@ class PPB_URLLoader_Impl : public Resource, public WebKit::WebURLLoaderClient { virtual void didReceiveData(WebKit::WebURLLoader* loader, const char* data, int data_length, - int raw_data_length); + int encoded_data_length); virtual void didFinishLoading(WebKit::WebURLLoader* loader, double finish_time); virtual void didFail(WebKit::WebURLLoader* loader, |