summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorvsevik@chromium.org <vsevik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-31 19:01:48 +0000
committervsevik@chromium.org <vsevik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-31 19:01:48 +0000
commitc7d5601fa3df36215e46de17d5699b40bce82fa4 (patch)
tree351e51d291a64939e25a14a6e78f2ec9f88e3906 /webkit
parentc4bc58d55fb1b29f69fc1bccc93b74e56c99b010 (diff)
downloadchromium_src-c7d5601fa3df36215e46de17d5699b40bce82fa4.zip
chromium_src-c7d5601fa3df36215e46de17d5699b40bce82fa4.tar.gz
chromium_src-c7d5601fa3df36215e46de17d5699b40bce82fa4.tar.bz2
Migrated chromium to new didReceiveData method in WebURLLoaderClient
BUG=40502 Review URL: http://codereview.chromium.org/6737026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80039 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/ftp_directory_listing_response_delegate.cc2
-rw-r--r--webkit/glue/media/buffered_resource_loader.cc10
-rw-r--r--webkit/glue/media/buffered_resource_loader.h10
-rw-r--r--webkit/glue/media/buffered_resource_loader_unittest.cc6
-rw-r--r--webkit/glue/multipart_response_delegate.cc17
-rw-r--r--webkit/glue/multipart_response_delegate_unittest.cc15
-rw-r--r--webkit/glue/resource_fetcher.cc8
-rw-r--r--webkit/glue/resource_fetcher.h6
-rw-r--r--webkit/glue/weburlloader_impl.cc3
-rw-r--r--webkit/plugins/npapi/webplugin_impl.cc30
-rw-r--r--webkit/plugins/npapi/webplugin_impl.h8
-rw-r--r--webkit/plugins/ppapi/ppapi_webplugin_impl.cc3
-rw-r--r--webkit/plugins/ppapi/ppb_url_loader_impl.cc9
-rw-r--r--webkit/plugins/ppapi/ppb_url_loader_impl.h8
-rw-r--r--webkit/support/weburl_loader_mock.cc3
15 files changed, 114 insertions, 24 deletions
diff --git a/webkit/glue/ftp_directory_listing_response_delegate.cc b/webkit/glue/ftp_directory_listing_response_delegate.cc
index a94d299..20be2b8 100644
--- a/webkit/glue/ftp_directory_listing_response_delegate.cc
+++ b/webkit/glue/ftp_directory_listing_response_delegate.cc
@@ -110,7 +110,7 @@ void FtpDirectoryListingResponseDelegate::Init(const GURL& response_url) {
void FtpDirectoryListingResponseDelegate::SendDataToClient(
const std::string& data) {
- client_->didReceiveData(loader_, data.data(), data.length());
+ client_->didReceiveData2(loader_, data.data(), data.length(), -1);
}
} // namespace webkit_glue
diff --git a/webkit/glue/media/buffered_resource_loader.cc b/webkit/glue/media/buffered_resource_loader.cc
index c6295bf..5adb76f 100644
--- a/webkit/glue/media/buffered_resource_loader.cc
+++ b/webkit/glue/media/buffered_resource_loader.cc
@@ -318,10 +318,20 @@ void BufferedResourceLoader::didReceiveResponse(
DoneStart(net::OK);
}
+// FIXME(vsevik): remove once removed in webkit
void BufferedResourceLoader::didReceiveData(
WebURLLoader* loader,
const char* data,
int data_length) {
+ didReceiveData2(loader, data, data_length, -1);
+}
+
+// FIXME(vsevik): rename once renamed in webkit
+void BufferedResourceLoader::didReceiveData2(
+ WebURLLoader* loader,
+ const char* data,
+ int data_length,
+ int length_received) {
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 4d76adc..3e04b43 100644
--- a/webkit/glue/media/buffered_resource_loader.h
+++ b/webkit/glue/media/buffered_resource_loader.h
@@ -124,7 +124,15 @@ class BufferedResourceLoader :
const WebKit::WebURLResponse& response);
virtual void didDownloadData(
WebKit::WebURLLoader* loader,
- int dataLength);
+ int data_length);
+ // FIXME(vsevik): rename once renamed in webkit
+ virtual void didReceiveData2(
+ WebKit::WebURLLoader* loader,
+ const char* data,
+ int data_length,
+ int length_received);
+
+ // FIXME(vsevik): remove once removed in webkit
virtual void didReceiveData(
WebKit::WebURLLoader* loader,
const char* data,
diff --git a/webkit/glue/media/buffered_resource_loader_unittest.cc b/webkit/glue/media/buffered_resource_loader_unittest.cc
index aef44ca..bb6e7d9 100644
--- a/webkit/glue/media/buffered_resource_loader_unittest.cc
+++ b/webkit/glue/media/buffered_resource_loader_unittest.cc
@@ -159,8 +159,10 @@ class BufferedResourceLoaderTest : public testing::Test {
void WriteLoader(int position, int size) {
EXPECT_CALL(*this, NetworkCallback())
.RetiresOnSaturation();
- loader_->didReceiveData(url_loader_,
- reinterpret_cast<char*>(data_ + position), size);
+ // FIXME(vsevik): rename once renamed in webkit
+ loader_->didReceiveData2(url_loader_,
+ reinterpret_cast<char*>(data_ + position), size,
+ size);
}
// Helper method to read from |loader_|.
diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc
index d2c47d7..a32520e 100644
--- a/webkit/glue/multipart_response_delegate.cc
+++ b/webkit/glue/multipart_response_delegate.cc
@@ -138,9 +138,10 @@ void MultipartResponseDelegate::OnReceivedData(const char* data,
}
if (data_length > 0) {
// Send the last data chunk.
- client_->didReceiveData(loader_,
- data_.data(),
- static_cast<int>(data_length));
+ // FIXME(vsevik): rename once renamed in webkit
+ client_->didReceiveData2(loader_,
+ data_.data(),
+ static_cast<int>(data_length), -1);
}
}
size_t boundary_end_pos = boundary_pos + boundary_.length();
@@ -170,8 +171,9 @@ void MultipartResponseDelegate::OnReceivedData(const char* data,
int send_length = data_.length() - boundary_.length();
if (data_[data_.length() - 1] == '\n')
send_length = data_.length();
+ // FIXME(vsevik): rename didReceiveData2 once renamed in webkit
if (client_)
- client_->didReceiveData(loader_, data_.data(), send_length);
+ client_->didReceiveData2(loader_, data_.data(), send_length, -1);
data_ = data_.substr(send_length);
}
}
@@ -180,9 +182,10 @@ void MultipartResponseDelegate::OnCompletedRequest() {
// If we have any pending data and we're not in a header, go ahead and send
// it to WebCore.
if (!processing_headers_ && !data_.empty() && !stop_sending_ && client_) {
- client_->didReceiveData(loader_,
- data_.data(),
- static_cast<int>(data_.length()));
+ // FIXME(vsevik): rename didReceiveData2 once renamed in webkit
+ client_->didReceiveData2(loader_,
+ data_.data(),
+ static_cast<int>(data_.length()), -1);
}
}
diff --git a/webkit/glue/multipart_response_delegate_unittest.cc b/webkit/glue/multipart_response_delegate_unittest.cc
index fbefaaa..c48c2de 100644
--- a/webkit/glue/multipart_response_delegate_unittest.cc
+++ b/webkit/glue/multipart_response_delegate_unittest.cc
@@ -66,12 +66,23 @@ class MockWebURLLoaderClient : public WebURLLoaderClient {
response_ = response;
data_.clear();
}
- virtual void didReceiveData(WebURLLoader* loader,
- const char* data, int data_length) {
+ // FIXME(vsevik): rename once renamed in webkit
+ virtual void didReceiveData2(
+ WebKit::WebURLLoader* loader,
+ const char* data,
+ int data_length,
+ int length_received) {
++received_data_;
data_.append(data, data_length);
}
+ // FIXME(vsevik): remove once removed in webkit
+ virtual void didReceiveData(
+ WebKit::WebURLLoader* loader,
+ const char* data,
+ int data_length) {
+ didReceiveData2(loader, data, data_length, -1);
+ }
virtual void didFinishLoading(WebURLLoader*, double finishTime) {}
virtual void didFail(WebURLLoader*, const WebURLError&) {}
diff --git a/webkit/glue/resource_fetcher.cc b/webkit/glue/resource_fetcher.cc
index 39cc59c..b0ee667 100644
--- a/webkit/glue/resource_fetcher.cc
+++ b/webkit/glue/resource_fetcher.cc
@@ -84,8 +84,16 @@ void ResourceFetcher::didReceiveResponse(
response_ = response;
}
+// FIXME(vsevik): remove once removed in webkit
void ResourceFetcher::didReceiveData(
WebURLLoader* loader, const char* data, int data_length) {
+ didReceiveData2(loader, data, data_length, -1);
+}
+
+// FIXME(vsevik): rename once renamed in webkit
+void ResourceFetcher::didReceiveData2(
+ WebURLLoader* loader, const char* data, int data_length,
+ int length_received) {
DCHECK(!completed_);
DCHECK(data_length > 0);
diff --git a/webkit/glue/resource_fetcher.h b/webkit/glue/resource_fetcher.h
index a814b41..726e279 100644
--- a/webkit/glue/resource_fetcher.h
+++ b/webkit/glue/resource_fetcher.h
@@ -63,8 +63,14 @@ class ResourceFetcher : public WebKit::WebURLLoaderClient {
WebKit::WebURLLoader* loader, const WebKit::WebURLResponse& response);
virtual void didReceiveCachedMetadata(
WebKit::WebURLLoader* loader, const char* data, int data_length);
+
+ // FIXME(vsevik): remove once removed in webkit
virtual void didReceiveData(
WebKit::WebURLLoader* loader, const char* data, int data_length);
+ // FIXME(vsevik): rename once renamed in webkit
+ virtual void didReceiveData2(
+ WebKit::WebURLLoader* loader, const char* data, int data_length,
+ int length_received);
virtual void didFinishLoading(
WebKit::WebURLLoader* loader, double finishTime);
virtual void didFail(
diff --git a/webkit/glue/weburlloader_impl.cc b/webkit/glue/weburlloader_impl.cc
index 48813b5..6182815 100644
--- a/webkit/glue/weburlloader_impl.cc
+++ b/webkit/glue/weburlloader_impl.cc
@@ -606,7 +606,8 @@ void WebURLLoaderImpl::Context::OnReceivedData(const char* data, int len) {
// client_->didReceiveData and client_->didReceiveResponse.
multipart_delegate_->OnReceivedData(data, len);
} else {
- client_->didReceiveData(loader_, data, len);
+ // FIXME(vsevik): rename once renamed in webkit
+ client_->didReceiveData2(loader_, data, len, -1);
}
}
diff --git a/webkit/plugins/npapi/webplugin_impl.cc b/webkit/plugins/npapi/webplugin_impl.cc
index 86002c4..ef48e40 100644
--- a/webkit/plugins/npapi/webplugin_impl.cc
+++ b/webkit/plugins/npapi/webplugin_impl.cc
@@ -110,14 +110,21 @@ class MultiPartResponseClient : public WebURLLoaderClient {
}
// Receives individual part data from a multipart response.
- virtual void didReceiveData(
- WebURLLoader*, const char* data, int data_size) {
+ // FIXME(vsevik): rename once renamed in webkit
+ virtual void didReceiveData2(
+ WebURLLoader*, const char* data, int data_length, int length_received) {
// TODO(ananta)
// We should defer further loads on multipart resources on the same lines
// as regular resources requested by plugins to prevent reentrancy.
resource_client_->DidReceiveData(
- data, data_size, byte_range_lower_bound_);
- byte_range_lower_bound_ += data_size;
+ data, data_length, byte_range_lower_bound_);
+ byte_range_lower_bound_ += data_length;
+ }
+
+ // FIXME(vsevik): remove once removed in webkit
+ virtual void didReceiveData(
+ WebURLLoader* webURLLoader, const char* data, int data_length) {
+ didReceiveData2(webURLLoader, data, data_length, -1);
}
virtual void didFinishLoading(WebURLLoader*, double finishTime) {}
@@ -949,9 +956,18 @@ void WebPluginImpl::didReceiveResponse(WebURLLoader* loader,
}
}
+// FIXME(vsevik): remove once removed in webkit
void WebPluginImpl::didReceiveData(WebURLLoader* loader,
const char *buffer,
- int length) {
+ int data_length) {
+ didReceiveData2(loader, buffer, data_length, -1);
+}
+
+// FIXME(vsevik): rename once renamed in webkit
+void WebPluginImpl::didReceiveData2(WebURLLoader* loader,
+ const char *buffer,
+ int data_length,
+ int length_received) {
WebPluginResourceClient* client = GetClientFromLoader(loader);
if (!client)
return;
@@ -961,10 +977,10 @@ 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, length);
+ multi_part_handler->OnReceivedData(buffer, data_length);
} else {
loader->setDefersLoading(true);
- client->DidReceiveData(buffer, length, 0);
+ client->DidReceiveData(buffer, data_length, 0);
}
}
diff --git a/webkit/plugins/npapi/webplugin_impl.h b/webkit/plugins/npapi/webplugin_impl.h
index 8b6177e..0821ef7 100644
--- a/webkit/plugins/npapi/webplugin_impl.h
+++ b/webkit/plugins/npapi/webplugin_impl.h
@@ -203,8 +203,14 @@ class WebPluginImpl : public WebPlugin,
unsigned long long total_bytes_to_be_sent);
virtual void didReceiveResponse(WebKit::WebURLLoader* loader,
const WebKit::WebURLResponse& response);
+
+ // FIXME(vsevik): remove once migrated to new webkit
virtual void didReceiveData(WebKit::WebURLLoader* loader, const char *buffer,
- int length);
+ int data_length);
+
+ // FIXME(vsevik): rename once renamed in webkit
+ virtual void didReceiveData2(WebKit::WebURLLoader* loader, const char *buffer,
+ int data_length, int length_received);
virtual void didFinishLoading(WebKit::WebURLLoader* loader,
double finishTime);
virtual void didFail(WebKit::WebURLLoader* loader,
diff --git a/webkit/plugins/ppapi/ppapi_webplugin_impl.cc b/webkit/plugins/ppapi/ppapi_webplugin_impl.cc
index 8a35638..57ae78b 100644
--- a/webkit/plugins/ppapi/ppapi_webplugin_impl.cc
+++ b/webkit/plugins/ppapi/ppapi_webplugin_impl.cc
@@ -148,8 +148,9 @@ void WebPluginImpl::didReceiveResponse(
}
void WebPluginImpl::didReceiveData(const char* data, int data_length) {
+ // FIXME(vsevik): rename didReceiveData2 once renamed in webkit
if (document_loader_)
- document_loader_->didReceiveData(NULL, data, data_length);
+ document_loader_->didReceiveData2(NULL, data, data_length, data_length);
}
void WebPluginImpl::didFinishLoading() {
diff --git a/webkit/plugins/ppapi/ppb_url_loader_impl.cc b/webkit/plugins/ppapi/ppb_url_loader_impl.cc
index e73ec96..2390443 100644
--- a/webkit/plugins/ppapi/ppb_url_loader_impl.cc
+++ b/webkit/plugins/ppapi/ppb_url_loader_impl.cc
@@ -420,9 +420,18 @@ void PPB_URLLoader_Impl::didDownloadData(WebURLLoader* loader,
UpdateStatus();
}
+// FIXME(vsevik): remove once removed in webkit
void PPB_URLLoader_Impl::didReceiveData(WebURLLoader* loader,
const char* data,
int data_length) {
+ didReceiveData2(loader, data, data_length, -1);
+}
+
+// FIXME(vsevik): rename didReceiveData2 once renamed in webkit
+void PPB_URLLoader_Impl::didReceiveData2(WebURLLoader* loader,
+ const char* data,
+ int data_length,
+ int length_received) {
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 48b416d..79b2ef5 100644
--- a/webkit/plugins/ppapi/ppb_url_loader_impl.h
+++ b/webkit/plugins/ppapi/ppb_url_loader_impl.h
@@ -76,9 +76,17 @@ class PPB_URLLoader_Impl : public Resource, public WebKit::WebURLLoaderClient {
const WebKit::WebURLResponse& response);
virtual void didDownloadData(WebKit::WebURLLoader* loader,
int data_length);
+
+ // FIXME(vsevik): remove once removed in webkit
virtual void didReceiveData(WebKit::WebURLLoader* loader,
const char* data,
int data_length);
+
+ // FIXME(vsevik): rename didReceiveData2 once renamed in webkit
+ virtual void didReceiveData2(WebKit::WebURLLoader* loader,
+ const char* data,
+ int data_length,
+ int length_received);
virtual void didFinishLoading(WebKit::WebURLLoader* loader,
double finish_time);
virtual void didFail(WebKit::WebURLLoader* loader,
diff --git a/webkit/support/weburl_loader_mock.cc b/webkit/support/weburl_loader_mock.cc
index caeed5d..d98660b 100644
--- a/webkit/support/weburl_loader_mock.cc
+++ b/webkit/support/weburl_loader_mock.cc
@@ -29,7 +29,8 @@ void WebURLLoaderMock::ServeAsynchronousRequest(
return;
client_->didReceiveResponse(this, response);
- client_->didReceiveData(this, data.data(), data.size());
+ // FIXME(vsevik): rename didReceiveData2 once renamed in webkit
+ client_->didReceiveData2(this, data.data(), data.size(), data.size());
client_->didFinishLoading(this, 0);
}