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

Unified Diff: content/browser/renderer_host/resource_dispatcher_host_impl.cc

Issue 10834289: Split net::UploadData into two: for IPC and for upload handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 8 years, 4 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/browser/renderer_host/resource_dispatcher_host_impl.cc
diff --git a/content/browser/renderer_host/resource_dispatcher_host_impl.cc b/content/browser/renderer_host/resource_dispatcher_host_impl.cc
index 052e5ce9d52d6a8249849bdb17ec96617a296e13..83cfbffd3f0109499b94eab72be63afa0119acac 100644
--- a/content/browser/renderer_host/resource_dispatcher_host_impl.cc
+++ b/content/browser/renderer_host/resource_dispatcher_host_impl.cc
@@ -40,10 +40,10 @@
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/resource_message_filter.h"
-#include "content/browser/renderer_host/transfer_navigation_resource_throttle.h"
#include "content/browser/renderer_host/resource_request_info_impl.h"
#include "content/browser/renderer_host/sync_resource_handler.h"
#include "content/browser/renderer_host/throttling_resource_handler.h"
+#include "content/browser/renderer_host/transfer_navigation_resource_throttle.h"
#include "content/browser/resource_context_impl.h"
#include "content/browser/worker_host/worker_service_impl.h"
#include "content/common/resource_messages.h"
@@ -83,11 +83,13 @@
#include "webkit/blob/blob_storage_controller.h"
#include "webkit/blob/shareable_file_reference.h"
#include "webkit/glue/webkit_glue.h"
+#include "webkit/glue/resource_request_body.h"
darin (slow to review) 2012/08/15 17:49:55 nit: sort
kinuko 2012/08/16 08:14:59 Done.
using base::Time;
using base::TimeDelta;
using base::TimeTicks;
using webkit_blob::ShareableFileReference;
+using webkit_glue::ResourceRequestBody;
// ----------------------------------------------------------------------------
@@ -171,12 +173,12 @@ bool ShouldServiceRequest(ProcessType process_type,
}
// Check if the renderer is permitted to upload the requested files.
- if (request_data.upload_data) {
- const std::vector<net::UploadData::Element>* uploads =
- request_data.upload_data->elements();
- std::vector<net::UploadData::Element>::const_iterator iter;
+ if (request_data.request_body) {
+ const std::vector<ResourceRequestBody::Element>* uploads =
+ request_data.request_body->elements();
+ std::vector<ResourceRequestBody::Element>::const_iterator iter;
for (iter = uploads->begin(); iter != uploads->end(); ++iter) {
- if (iter->type() == net::UploadData::TYPE_FILE &&
+ if (iter->type() == ResourceRequestBody::TYPE_FILE &&
!policy->CanReadFile(child_id, iter->file_path())) {
NOTREACHED() << "Denied unauthorized upload of "
<< iter->file_path().value();
@@ -899,9 +901,10 @@ void ResourceDispatcherHostImpl::BeginRequest(
CHECK(ContainsKey(active_resource_contexts_, resource_context));
// Might need to resolve the blob references in the upload data.
- if (request_data.upload_data) {
+ if (request_data.request_body) {
GetBlobStorageControllerForResourceContext(resource_context)->
- ResolveBlobReferencesInUploadData(request_data.upload_data.get());
+ ResolveBlobReferencesInResourceRequestBody(
+ request_data.request_body.get());
}
if (is_shutdown_ ||
@@ -963,11 +966,13 @@ void ResourceDispatcherHostImpl::BeginRequest(
// Set upload data.
uint64 upload_size = 0;
- if (request_data.upload_data) {
- request->set_upload(request_data.upload_data);
+ if (request_data.request_body) {
+ scoped_refptr<net::UploadData> upload = new net::UploadData;
+ request_data.request_body->PopulateUploadData(upload.get());
+ request->set_upload(upload);
// This results in performing file IO. crbug.com/112607.
base::ThreadRestrictions::ScopedAllowIO allow_io;
- upload_size = request_data.upload_data->GetContentLengthSync();
+ upload_size = upload->GetContentLengthSync();
}
bool allow_download = request_data.allow_download &&

Powered by Google App Engine
This is Rietveld 408576698