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

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

Issue 9580002: Add ResourceRequestInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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_request_info.cc
===================================================================
--- content/browser/renderer_host/resource_dispatcher_host_request_info.cc (revision 124423)
+++ content/browser/renderer_host/resource_dispatcher_host_request_info.cc (working copy)
@@ -6,10 +6,13 @@
#include "content/browser/renderer_host/resource_handler.h"
#include "content/browser/ssl/ssl_client_auth_handler.h"
+#include "content/browser/worker_host/worker_service_impl.h"
#include "content/public/browser/resource_dispatcher_host_login_delegate.h"
#include "net/url_request/url_request.h"
#include "webkit/blob/blob_data.h"
+using content::WorkerServiceImpl;
+
ResourceDispatcherHostRequestInfo::ResourceDispatcherHostRequestInfo(
ResourceHandler* handler,
content::ProcessType process_type,
@@ -29,30 +32,30 @@
bool has_user_gesture,
WebKit::WebReferrerPolicy referrer_policy,
content::ResourceContext* context)
- : resource_handler_(handler),
+ : ResourceRequestInfo(context,
+ child_id,
+ route_id,
+ origin_pid,
+ request_id,
+ is_main_frame,
+ frame_id,
+ parent_is_main_frame,
+ parent_frame_id,
+ resource_type,
+ referrer_policy,
+ upload_size),
+ resource_handler_(handler),
cross_site_handler_(NULL),
process_type_(process_type),
- child_id_(child_id),
- route_id_(route_id),
- origin_pid_(origin_pid),
- request_id_(request_id),
- is_main_frame_(is_main_frame),
- frame_id_(frame_id),
- parent_is_main_frame_(parent_is_main_frame),
- parent_frame_id_(parent_frame_id),
pending_data_count_(0),
is_download_(is_download),
allow_download_(allow_download),
has_user_gesture_(has_user_gesture),
pause_count_(0),
- resource_type_(resource_type),
transition_type_(transition_type),
- upload_size_(upload_size),
last_upload_position_(0),
waiting_for_upload_progress_ack_(false),
memory_cost_(0),
- referrer_policy_(referrer_policy),
- context_(context),
is_paused_(false),
called_on_response_started_(false),
has_started_reading_(false),
@@ -60,9 +63,30 @@
}
ResourceDispatcherHostRequestInfo::~ResourceDispatcherHostRequestInfo() {
- resource_handler_->OnRequestClosed();
+ if (resource_handler_)
+ resource_handler_->OnRequestClosed();
}
+bool ResourceDispatcherHostRequestInfo::GetAssociatedRenderView(
+ int* render_process_id,
+ int* render_view_id) const {
+ // If the request is from the worker process, find a tab that owns the worker.
+ if (process_type_ == content::PROCESS_TYPE_WORKER) {
+ // Need to display some related UI for this network request - pick an
+ // arbitrary parent to do so.
+ if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker(
+ child_id_, render_process_id, render_view_id)) {
+ *render_process_id = -1;
+ *render_view_id = -1;
+ return false;
+ }
+ } else {
+ *render_process_id = child_id_;
+ *render_view_id = route_id_;
+ }
+ return true;
+}
+
void ResourceDispatcherHostRequestInfo::set_resource_handler(
ResourceHandler* resource_handler) {
resource_handler_ = resource_handler;

Powered by Google App Engine
This is Rietveld 408576698