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

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

Issue 2481093003: Introduce ResourceRequesterInfo to abstract the requester of resource request (Closed)
Patch Set: make ResourceRequestInfoImpl::requester_info() non-const 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_request_info_impl.h
diff --git a/content/browser/loader/resource_request_info_impl.h b/content/browser/loader/resource_request_info_impl.h
index 97cc7198960a0a171c24e5a3992d115a2405be8a..934e3e4c15b402e56dc545c456562e260267d367 100644
--- a/content/browser/loader/resource_request_info_impl.h
+++ b/content/browser/loader/resource_request_info_impl.h
@@ -12,9 +12,8 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
#include "base/supports_user_data.h"
-#include "content/browser/service_worker/service_worker_context_wrapper.h"
+#include "content/browser/loader/resource_requester_info.h"
#include "content/common/resource_request_body_impl.h"
#include "content/public/browser/navigation_ui_data.h"
#include "content/public/browser/resource_request_info.h"
@@ -25,7 +24,6 @@
namespace content {
class DetachableResourceHandler;
class ResourceContext;
-class ResourceMessageFilter;
struct GlobalRequestID;
struct GlobalRoutingID;
@@ -43,8 +41,7 @@ class ResourceRequestInfoImpl : public ResourceRequestInfo,
const net::URLRequest* request);
CONTENT_EXPORT ResourceRequestInfoImpl(
- int process_type,
- int child_id,
+ scoped_refptr<ResourceRequesterInfo> requester_info,
int route_id,
int frame_tree_node_id,
int origin_pid,
@@ -65,7 +62,6 @@ class ResourceRequestInfoImpl : public ResourceRequestInfo,
blink::WebReferrerPolicy referrer_policy,
blink::WebPageVisibilityState visibility_state,
ResourceContext* context,
- base::WeakPtr<ResourceMessageFilter> filter,
bool report_raw_headers,
bool is_async,
bool is_using_lofi,
@@ -110,21 +106,17 @@ class ResourceRequestInfoImpl : public ResourceRequestInfo,
// request).
int frame_tree_node_id() const { return frame_tree_node_id_; }
- // May be NULL (e.g., if process dies during a transfer).
- ResourceMessageFilter* filter() const {
- return filter_.get();
- }
+ ResourceRequesterInfo& requester_info() { return *requester_info_; }
mmenke 2016/11/22 17:44:12 Returning non-const references is forbidden. Retu
horo 2016/11/24 04:07:11 Done.
// Updates the data associated with this request after it is is transferred
// to a new renderer process. Not all data will change during a transfer.
// We do not expect the ResourceContext to change during navigation, so that
// does not need to be updated.
- void UpdateForTransfer(int child_id,
- int route_id,
+ void UpdateForTransfer(int route_id,
int render_frame_id,
int origin_pid,
int request_id,
- base::WeakPtr<ResourceMessageFilter> filter);
+ ResourceRequesterInfo* requester_info);
// Whether this request is part of a navigation that should replace the
// current session history entry. This state is shuffled up and down the stack
@@ -141,9 +133,6 @@ class ResourceRequestInfoImpl : public ResourceRequestInfo,
detachable_handler_ = h;
}
- // Identifies the type of process (renderer, plugin, etc.) making the request.
- int process_type() const { return process_type_; }
-
// Downloads are allowed only as a top level request.
bool allow_download() const { return allow_download_; }
@@ -198,17 +187,6 @@ class ResourceRequestInfoImpl : public ResourceRequestInfo,
navigation_ui_data_ = std::move(navigation_ui_data);
}
- // PlzNavigate: used in navigations to store the ServiceWorkerContext, since
- // the ResourceMessageFilter will be null in this case. All other requests
- // should access the ServiceWorkerContext through the ResourceMessageFilter.
- void set_service_worker_context(
- scoped_refptr<ServiceWorkerContextWrapper> service_worker_context) {
- service_worker_context_ = service_worker_context;
- }
- ServiceWorkerContextWrapper* service_worker_context() const {
- return service_worker_context_.get();
- }
-
private:
FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
DeletedFilterDetached);
@@ -217,8 +195,7 @@ class ResourceRequestInfoImpl : public ResourceRequestInfo,
// Non-owning, may be NULL.
DetachableResourceHandler* detachable_handler_;
- int process_type_;
- int child_id_;
+ scoped_refptr<ResourceRequesterInfo> requester_info_;
int route_id_;
const int frame_tree_node_id_;
int origin_pid_;
@@ -242,9 +219,6 @@ class ResourceRequestInfoImpl : public ResourceRequestInfo,
blink::WebReferrerPolicy referrer_policy_;
blink::WebPageVisibilityState visibility_state_;
ResourceContext* context_;
- // The filter might be deleted without deleting this object if the process
- // exits during a transfer.
- base::WeakPtr<ResourceMessageFilter> filter_;
bool report_raw_headers_;
bool is_async_;
bool is_using_lofi_;
@@ -252,7 +226,6 @@ class ResourceRequestInfoImpl : public ResourceRequestInfo,
scoped_refptr<ResourceRequestBodyImpl> body_;
bool initiated_in_secure_context_;
std::unique_ptr<NavigationUIData> navigation_ui_data_;
- scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl);
};

Powered by Google App Engine
This is Rietveld 408576698