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

Unified Diff: content/browser/service_worker/service_worker_fetch_dispatcher.h

Issue 2417793002: Introduce FetchEventPreloadHandle to pass the preload response to FetchEvent. (Closed)
Patch Set: incorporated dchecng's comment Created 4 years, 2 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/service_worker/service_worker_fetch_dispatcher.h
diff --git a/content/browser/service_worker/service_worker_fetch_dispatcher.h b/content/browser/service_worker/service_worker_fetch_dispatcher.h
index 0011f475ca695ba54256119eeb8898664ca168f8..3d32ce39b79c2e463d71e2dd3919263c21bfa80a 100644
--- a/content/browser/service_worker/service_worker_fetch_dispatcher.h
+++ b/content/browser/service_worker/service_worker_fetch_dispatcher.h
@@ -10,11 +10,16 @@
#include "base/memory/weak_ptr.h"
#include "content/browser/service_worker/service_worker_metrics.h"
#include "content/common/content_export.h"
+#include "content/common/service_worker/fetch_event_dispatcher.mojom.h"
#include "content/common/service_worker/service_worker_status_code.h"
#include "content/common/service_worker/service_worker_types.h"
#include "content/public/common/resource_type.h"
#include "net/log/net_log_with_source.h"
+namespace net {
+class URLRequest;
+} // namespace net
+
namespace content {
class ServiceWorkerVersion;
@@ -37,6 +42,10 @@ class CONTENT_EXPORT ServiceWorkerFetchDispatcher {
const FetchCallback& fetch_callback);
~ServiceWorkerFetchDispatcher();
+ // If appropriate, starts the navigation preload request and creates
+ // |preload_handle_|.
+ void MaybeStartNavigationPreload(net::URLRequest* original_request);
+
// Dispatches a fetch event to the |version| given in ctor, and fires
// |fetch_callback| (also given in ctor) when finishes. It runs
// |prepare_callback| as an intermediate step once the version is activated
@@ -69,6 +78,8 @@ class CONTENT_EXPORT ServiceWorkerFetchDispatcher {
std::unique_ptr<ServiceWorkerFetchRequest> request_;
ResourceType resource_type_;
bool did_complete_;
+ mojom::FetchEventPreloadHandlePtr preload_handle_;
+
base::WeakPtrFactory<ServiceWorkerFetchDispatcher> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerFetchDispatcher);

Powered by Google App Engine
This is Rietveld 408576698