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

Unified Diff: content/browser/renderer_host/resource_dispatcher_host.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.cc
===================================================================
--- content/browser/renderer_host/resource_dispatcher_host.cc (revision 124423)
+++ content/browser/renderer_host/resource_dispatcher_host.cc (working copy)
@@ -90,6 +90,7 @@
using content::BrowserThread;
using content::GlobalRequestID;
using content::ResourceContext;
+using content::ResourceRequestInfo;
using content::ResourceResponse;
using content::ResourceThrottle;
using content::ThrottlingResourceHandler;
@@ -1917,39 +1918,23 @@
// static
const ResourceDispatcherHostRequestInfo* ResourceDispatcherHost::InfoForRequest(
const net::URLRequest* request) {
- const ResourceDispatcherHostRequestInfo* info =
- static_cast<const ResourceDispatcherHostRequestInfo*>(
- request->GetUserData(NULL));
- return info;
+ return static_cast<const ResourceDispatcherHostRequestInfo*>(
+ ResourceRequestInfo::ForRequest(request));
}
// static
bool ResourceDispatcherHost::RenderViewForRequest(
const net::URLRequest* request,
- int* render_process_host_id,
- int* render_view_host_id) {
+ int* render_process_id,
+ int* render_view_id) {
const ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
if (!info) {
- *render_process_host_id = -1;
- *render_view_host_id = -1;
+ *render_process_id = -1;
+ *render_view_id = -1;
return false;
}
- // If the request is from the worker process, find a tab that owns the worker.
- if (info->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(
- info->child_id(), render_process_host_id, render_view_host_id)) {
- *render_process_host_id = -1;
- *render_view_host_id = -1;
- return false;
- }
- } else {
- *render_process_host_id = info->child_id();
- *render_view_host_id = info->route_id();
- }
- return true;
+ return info->GetAssociatedRenderView(render_process_id, render_view_id);
}
net::URLRequest* ResourceDispatcherHost::GetURLRequest(

Powered by Google App Engine
This is Rietveld 408576698