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

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: rebase + moved ResolveBlobRef from webkit_blob to webkit_glue 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 c816bd63af26cae2840d65be93c6eb2f0c27a272..8ab6d621b13b2423c7e88c766b714652f82f7115 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"
@@ -82,12 +82,14 @@
#include "webkit/appcache/appcache_interfaces.h"
#include "webkit/blob/blob_storage_controller.h"
#include "webkit/blob/shareable_file_reference.h"
+#include "webkit/glue/resource_request_body.h"
#include "webkit/glue/webkit_glue.h"
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::UploadElement>* uploads =
- request_data.upload_data->elements();
- std::vector<net::UploadElement>::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::UploadElement::TYPE_FILE &&
+ if (iter->type() == ResourceRequestBody::TYPE_FILE &&
!policy->CanReadFile(child_id, iter->file_path())) {
NOTREACHED() << "Denied unauthorized upload of "
<< iter->file_path().value();
@@ -898,12 +900,6 @@ void ResourceDispatcherHostImpl::BeginRequest(
// http://crbug.com/90971
CHECK(ContainsKey(active_resource_contexts_, resource_context));
- // Might need to resolve the blob references in the upload data.
- if (request_data.upload_data) {
- GetBlobStorageControllerForResourceContext(resource_context)->
- ResolveBlobReferencesInUploadData(request_data.upload_data.get());
- }
-
if (is_shutdown_ ||
!ShouldServiceRequest(process_type, child_id, request_data)) {
AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id);
@@ -961,13 +957,15 @@ void ResourceDispatcherHostImpl::BeginRequest(
request->set_priority(DetermineRequestPriority(request_data.resource_type));
- // Set upload data.
+ // Resolve elements from request_body and prepare upload data.
uint64 upload_size = 0;
- if (request_data.upload_data) {
- request->set_upload(request_data.upload_data);
+ if (request_data.request_body) {
+ request->set_upload(
+ request_data.request_body->ResolveElementsAndCreateUploadData(
+ GetBlobStorageControllerForResourceContext(resource_context)));
// This results in performing file IO. crbug.com/112607.
base::ThreadRestrictions::ScopedAllowIO allow_io;
- upload_size = request_data.upload_data->GetContentLengthSync();
+ upload_size = request->get_upload_mutable()->GetContentLengthSync();
}
bool allow_download = request_data.allow_download &&
« no previous file with comments | « chrome/browser/policy/device_management_service_browsertest.cc ('k') | content/common/resource_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698