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

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.h

Issue 2481093003: Introduce ResourceRequesterInfo to abstract the requester of resource request (Closed)
Patch Set: incorporated yhirano & kinuko's comment Created 4 years, 1 month 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/loader/resource_dispatcher_host_impl.h
diff --git a/content/browser/loader/resource_dispatcher_host_impl.h b/content/browser/loader/resource_dispatcher_host_impl.h
index a8fff5e60853cdbb913a7f5cda7ca5afe5e4509f..857f8c6091fabeed43f3831f73969dcffc65dbb6 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.h
+++ b/content/browser/loader/resource_dispatcher_host_impl.h
@@ -64,6 +64,7 @@ class ResourceDispatcherHostDelegate;
class ResourceHandler;
class ResourceMessageDelegate;
class ResourceMessageFilter;
+class ResourceRequesterInfo;
class ResourceRequestInfoImpl;
class ServiceWorkerNavigationHandleCore;
struct NavigationRequestInfo;
@@ -301,12 +302,12 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
const ResourceRequest& request,
mojom::URLLoaderAssociatedRequest mojo_request,
mojom::URLLoaderClientAssociatedPtr url_loader_client,
- ResourceMessageFilter* filter);
+ std::unique_ptr<ResourceRequesterInfo> requester_info);
void OnSyncLoadWithMojo(int routing_id,
int request_id,
const ResourceRequest& request_data,
- ResourceMessageFilter* filter,
+ std::unique_ptr<ResourceRequesterInfo> requester_info,
const SyncLoadResultCallback& result_handler);
// Helper function for initializing the |request| passed in. By initializing
@@ -519,18 +520,21 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
const GlobalFrameRoutingId& global_routing_id,
bool cancel_requests);
- void OnRequestResource(int routing_id,
+ void OnRequestResource(ResourceMessageFilter* filter,
+ int routing_id,
int request_id,
const ResourceRequest& request_data);
void OnRequestResourceInternal(
+ std::unique_ptr<ResourceRequesterInfo> requester_info,
int routing_id,
int request_id,
const ResourceRequest& request_data,
mojom::URLLoaderAssociatedRequest mojo_request,
mojom::URLLoaderClientAssociatedPtr url_loader_client);
- void OnSyncLoad(int request_id,
+ void OnSyncLoad(ResourceMessageFilter* filter,
+ int request_id,
const ResourceRequest& request_data,
IPC::Message* sync_result);
@@ -538,19 +542,22 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// Update the ResourceRequestInfo and internal maps when a request is
// transferred from one process to another.
- void UpdateRequestForTransfer(int child_id,
- int route_id,
- int request_id,
- const ResourceRequest& request_data,
- LoaderMap::iterator iter);
+ void UpdateRequestForTransfer(
+ std::unique_ptr<ResourceRequesterInfo> requester_info,
+ int route_id,
+ int request_id,
+ const ResourceRequest& request_data,
+ LoaderMap::iterator iter);
// If |request_data| is for a request being transferred from another process,
// then CompleteTransfer method can be used to complete the transfer.
- void CompleteTransfer(int request_id,
+ void CompleteTransfer(std::unique_ptr<ResourceRequesterInfo> requester_info,
+ int request_id,
const ResourceRequest& request_data,
int route_id);
void BeginRequest(
+ std::unique_ptr<ResourceRequesterInfo> requester_info,
int request_id,
const ResourceRequest& request_data,
const SyncLoadResultCallback& sync_result_handler, // only valid for sync
@@ -568,6 +575,7 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// request should be continued or aborted. The |error_code| parameter is set
// if |continue_request| is false.
void ContinuePendingBeginRequest(
+ std::unique_ptr<ResourceRequesterInfo> requester_info,
int request_id,
const ResourceRequest& request_data,
const SyncLoadResultCallback& sync_result_handler, // only valid for sync
@@ -581,11 +589,11 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// Creates a ResourceHandler to be used by BeginRequest() for normal resource
// loading.
std::unique_ptr<ResourceHandler> CreateResourceHandler(
+ const ResourceRequesterInfo* requester_info,
net::URLRequest* request,
const ResourceRequest& request_data,
const SyncLoadResultCallback& sync_result_handler,
int route_id,
- int process_type,
int child_id,
ResourceContext* resource_context,
mojom::URLLoaderAssociatedRequest mojo_request,
@@ -604,9 +612,10 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
int route_id,
std::unique_ptr<ResourceHandler> handler);
- void OnCancelRequest(int request_id);
- void OnReleaseDownloadedFile(int request_id);
- void OnDidChangePriority(int request_id,
+ void OnCancelRequest(ResourceMessageFilter* filter, int request_id);
+ void OnReleaseDownloadedFile(ResourceMessageFilter* filter, int request_id);
+ void OnDidChangePriority(ResourceMessageFilter* filter,
+ int request_id,
net::RequestPriority new_priority,
int intra_priority_value);
@@ -649,18 +658,16 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
ResourceMessageDelegate* delegate);
int BuildLoadFlagsForRequest(const ResourceRequest& request_data,
- int child_id,
bool is_sync_load);
// Consults the RendererSecurity policy to determine whether the
// ResourceDispatcherHostImpl should service this request. A request might
// be disallowed if the renderer is not authorized to retrieve the request
// URL or if the renderer is attempting to upload an unauthorized file.
- bool ShouldServiceRequest(int process_type,
- int child_id,
+ bool ShouldServiceRequest(int child_id,
const ResourceRequest& request_data,
const net::HttpRequestHeaders& headers,
- ResourceMessageFilter* filter,
+ ResourceRequesterInfo* requester_info,
ResourceContext* resource_context);
// Notifies the ResourceDispatcherHostDelegate about a download having
@@ -742,10 +749,6 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// may be because of explicit user action.
base::TimeTicks last_user_gesture_time_;
- // Used during IPC message dispatching so that the handlers can get a pointer
- // to the source of the message.
- ResourceMessageFilter* filter_;
-
ResourceDispatcherHostDelegate* delegate_;
LoaderDelegate* loader_delegate_;

Powered by Google App Engine
This is Rietveld 408576698