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

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

Issue 2497223002: Introduce a new ResourceRequesterInfo type for NavigationPreload. (Closed)
Patch Set: rebase Created 4 years 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_requester_info.h
diff --git a/content/browser/loader/resource_requester_info.h b/content/browser/loader/resource_requester_info.h
index 86e39d33a752ad890e6614b7705c439b19f7e80b..1de19d69dbddd659ad67d5c12468e248735b2568 100644
--- a/content/browser/loader/resource_requester_info.h
+++ b/content/browser/loader/resource_requester_info.h
@@ -29,11 +29,12 @@ class ResourceMessageFilter;
class ServiceWorkerContextWrapper;
// This class represents the type of resource requester.
-// Currently there are three types:
+// Currently there are four types:
// - Requesters that request resources from renderer processes.
// - Requesters that request resources within the browser process for browser
// side navigation (aka PlzNavigate).
// - Requesters that request resources for download or page save.
+// - Requesters that request service worker navigation preload requests.
class CONTENT_EXPORT ResourceRequesterInfo
: public base::RefCountedThreadSafe<ResourceRequesterInfo> {
public:
@@ -67,10 +68,19 @@ class CONTENT_EXPORT ResourceRequesterInfo
static scoped_refptr<ResourceRequesterInfo> CreateForDownloadOrPageSave(
int child_id);
+ // Creates a ResourceRequesterInfo for a service worker navigation preload
+ // request. When PlzNavigate is enabled, |original_request_info| must be
+ // browser side navigation type. Otherwise it must be renderer type.
+ static scoped_refptr<ResourceRequesterInfo> CreateForNavigationPreload(
+ ResourceRequesterInfo* original_request_info);
+
bool IsRenderer() const { return type_ == RequesterType::RENDERER; }
bool IsBrowserSideNavigation() const {
return type_ == RequesterType::BROWSER_SIDE_NAVIGATION;
}
+ bool IsNavigationPreload() const {
+ return type_ == RequesterType::NAVIGATION_PRELOAD;
+ }
// Returns the renderer process ID associated with the requester. Returns -1
// for browser side navigation requester. Even if the ResourceMessageFilter
@@ -88,7 +98,7 @@ class CONTENT_EXPORT ResourceRequesterInfo
// Returns the ResourceContext and URLRequestContext associated to the
// requester. Currently this method is available only for renderer type
- // requester.
+ // requester and service worker navigation preload type.
void GetContexts(ResourceType resource_type,
ResourceContext** resource_context,
net::URLRequestContext** request_context) const;
@@ -110,8 +120,9 @@ class CONTENT_EXPORT ResourceRequesterInfo
}
// Returns the ServiceWorkerContext associated with the requester. Currently
- // this method is available for renderer type requester and browser side
- // navigation type requester.
+ // this method is available for renderer type requester, browser side
+ // navigation type requester and service worker navigation preload type
+ // requester.
ServiceWorkerContextWrapper* service_worker_context() {
return service_worker_context_.get();
}
@@ -122,7 +133,8 @@ class CONTENT_EXPORT ResourceRequesterInfo
enum class RequesterType {
RENDERER,
BROWSER_SIDE_NAVIGATION,
- DOWNLOAD_OR_PAGE_SAVE
+ DOWNLOAD_OR_PAGE_SAVE,
+ NAVIGATION_PRELOAD
};
ResourceRequesterInfo(RequesterType type,
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.cc ('k') | content/browser/loader/resource_requester_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698