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

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 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 655d83fe80a4bde0b8343217f0838652104077a8..0906c2f0f43046d279567714022e7d4dc5138b68 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.h
+++ b/content/browser/loader/resource_dispatcher_host_impl.h
@@ -66,6 +66,7 @@ class ResourceLoader;
class ResourceHandler;
class ResourceMessageDelegate;
class ResourceMessageFilter;
+class ResourceRequesterInfo;
class ResourceRequestInfoImpl;
class ResourceScheduler;
class ServiceWorkerNavigationHandleCore;
@@ -135,7 +136,7 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// Returns true if the message was a resource message that was processed.
bool OnMessageReceived(const IPC::Message& message,
- ResourceMessageFilter* filter);
+ const ResourceRequesterInfo* requester_info);
// Cancels the given request if it still exists.
void CancelRequest(int child_id, int request_id);
@@ -295,17 +296,17 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// Called when loading a request with mojo.
void OnRequestResourceWithMojo(
+ const ResourceRequesterInfo* requester_info,
int routing_id,
int request_id,
const ResourceRequest& request,
mojom::URLLoaderAssociatedRequest mojo_request,
- mojom::URLLoaderClientAssociatedPtr url_loader_client,
- ResourceMessageFilter* filter);
+ mojom::URLLoaderClientAssociatedPtr url_loader_client);
- void OnSyncLoadWithMojo(int routing_id,
+ void OnSyncLoadWithMojo(const ResourceRequesterInfo* requester_info,
+ int routing_id,
int request_id,
const ResourceRequest& request_data,
- ResourceMessageFilter* filter,
const SyncLoadResultCallback& result_handler);
// Helper function for initializing the |request| passed in. By initializing
@@ -525,18 +526,21 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
const GlobalFrameRoutingId& global_routing_id,
bool cancel_requests);
- void OnRequestResource(int routing_id,
+ void OnRequestResource(const ResourceRequesterInfo* requester_info,
kinuko 2016/11/21 13:36:25 Wondering if many of these methods should also tak
+ int routing_id,
int request_id,
const ResourceRequest& request_data);
void OnRequestResourceInternal(
+ const 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(const ResourceRequesterInfo* requester_info,
+ int request_id,
const ResourceRequest& request_data,
IPC::Message* sync_result);
@@ -544,7 +548,7 @@ 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,
+ void UpdateRequestForTransfer(const ResourceRequesterInfo* requester_info,
int route_id,
int request_id,
const ResourceRequest& request_data,
@@ -552,11 +556,13 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// 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(const ResourceRequesterInfo* requester_info,
+ int request_id,
const ResourceRequest& request_data,
int route_id);
void BeginRequest(
+ const ResourceRequesterInfo* requester_info,
int request_id,
const ResourceRequest& request_data,
const SyncLoadResultCallback& sync_result_handler, // only valid for sync
@@ -574,6 +580,7 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// request should be continued or aborted. The |error_code| parameter is set
// if |continue_request| is false.
void ContinuePendingBeginRequest(
+ scoped_refptr<const ResourceRequesterInfo> requester_info,
int request_id,
const ResourceRequest& request_data,
const SyncLoadResultCallback& sync_result_handler, // only valid for sync
@@ -587,11 +594,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,
@@ -610,9 +617,12 @@ 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(const ResourceRequesterInfo* requester_info,
+ int request_id);
+ void OnReleaseDownloadedFile(const ResourceRequesterInfo* requester_info,
+ int request_id);
+ void OnDidChangePriority(const ResourceRequesterInfo* requester_info,
+ int request_id,
net::RequestPriority new_priority,
int intra_priority_value);
@@ -655,18 +665,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,
+ const ResourceRequesterInfo* requester_info,
ResourceContext* resource_context);
// Notifies the ResourceDispatcherHostDelegate about a download having
@@ -748,10 +756,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