Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(783)

Unified Diff: content/child/web_url_loader_impl.cc

Issue 1159113009: Revert of Make WebURLLoader capable of retaining received buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/child/web_url_loader_impl.cc
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc
index 4280dbc4363ab75fbbd9067a758e3238e768dd9b..3245de82a2d61bc69bce3e27ded02c1d65a9edb4 100644
--- a/content/child/web_url_loader_impl.cc
+++ b/content/child/web_url_loader_impl.cc
@@ -29,7 +29,6 @@
#include "content/common/resource_messages.h"
#include "content/common/resource_request_body.h"
#include "content/common/service_worker/service_worker_types.h"
-#include "content/public/child/fixed_received_data.h"
#include "content/public/child/request_peer.h"
#include "content/public/common/content_switches.h"
#include "net/base/data_url.h"
@@ -74,7 +73,7 @@
const size_t kBodyStreamPipeCapacity = 4 * 1024;
-using HeadersVector = ResourceDevToolsInfo::HeadersVector;
+typedef ResourceDevToolsInfo::HeadersVector HeadersVector;
// Converts timing data from |load_timing| to the format used by WebKit.
void PopulateURLLoadTiming(const net::LoadTimingInfo& load_timing,
@@ -314,7 +313,9 @@
const ResourceResponseInfo& info) override;
void OnReceivedResponse(const ResourceResponseInfo& info) override;
void OnDownloadedData(int len, int encoded_data_length) override;
- void OnReceivedData(scoped_ptr<ReceivedData> data) override;
+ void OnReceivedData(const char* data,
+ int data_length,
+ int encoded_data_length) override;
void OnReceivedCachedMetadata(const char* data, int len) override;
void OnCompletedRequest(int error_code,
bool was_ignored_by_handler,
@@ -677,17 +678,16 @@
client_->didDownloadData(loader_, len, encoded_data_length);
}
-void WebURLLoaderImpl::Context::OnReceivedData(scoped_ptr<ReceivedData> data) {
- const char* payload = data->payload();
- int data_length = data->length();
- int encoded_data_length = data->encoded_length();
+void WebURLLoaderImpl::Context::OnReceivedData(const char* data,
+ int data_length,
+ int encoded_data_length) {
if (!client_)
return;
if (request_.useStreamOnResponse()) {
// We don't support ftp_listening_delegate_ and multipart_delegate_ for now.
// TODO(yhirano): Support ftp listening and multipart.
- MojoResult rv = WriteDataOnBodyStream(payload, data_length);
+ MojoResult rv = WriteDataOnBodyStream(data, data_length);
if (rv != MOJO_RESULT_OK && client_) {
client_->didFail(
loader_, CreateWebURLError(request_.url(), false, net::ERR_FAILED));
@@ -698,17 +698,16 @@
// delegate may want to do work after sending data to the delegate, keep
// |this| and the delegate alive until it's finished handling the data.
scoped_refptr<Context> protect(this);
- ftp_listing_delegate_->OnReceivedData(payload, data_length);
+ ftp_listing_delegate_->OnReceivedData(data, data_length);
} else if (multipart_delegate_) {
// The multipart delegate will make the appropriate calls to
// client_->didReceiveData and client_->didReceiveResponse. Since the
// delegate may want to do work after sending data to the delegate, keep
// |this| and the delegate alive until it's finished handling the data.
scoped_refptr<Context> protect(this);
- multipart_delegate_->OnReceivedData(payload, data_length,
- encoded_data_length);
+ multipart_delegate_->OnReceivedData(data, data_length, encoded_data_length);
} else {
- client_->didReceiveData(loader_, payload, data_length, encoded_data_length);
+ client_->didReceiveData(loader_, data, data_length, encoded_data_length);
}
}
@@ -825,8 +824,7 @@
if (error_code == net::OK) {
OnReceivedResponse(info);
if (!data.empty())
- OnReceivedData(
- make_scoped_ptr(new FixedReceivedData(data.data(), data.size(), 0)));
+ OnReceivedData(data.data(), data.size(), 0);
}
OnCompletedRequest(error_code, false, false, info.security_info,
« no previous file with comments | « content/child/shared_memory_received_data_factory_unittest.cc ('k') | content/child/web_url_loader_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698