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

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

Issue 1399363004: PlzNavigate: Make ServiceWorker work with PlzNavigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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_navigation_handle_core.h
diff --git a/content/browser/service_worker/service_worker_navigation_handle_core.h b/content/browser/service_worker/service_worker_navigation_handle_core.h
new file mode 100644
index 0000000000000000000000000000000000000000..9c1e2b6e5461fc050b787c1955b3576bebda2aac
--- /dev/null
+++ b/content/browser/service_worker/service_worker_navigation_handle_core.h
@@ -0,0 +1,61 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_NAVIGATION_HANDLE_CORE_H_
+#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_NAVIGATION_HANDLE_CORE_H_
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+
+namespace content {
+
+class ServiceWorkerContextWrapper;
+class ServiceWorkerNavigationHandle;
+class ServiceWorkerProviderHost;
+
+// PlzNavigate
+// This class is used to manage the lifetime of ServiceWorkerProviderHosts
+// created during navigations. This class is created on the UI thread, but
+// should only be accessed from the IO thread afterwards. It is the IO thread
+// pendant of ServiceWorkerNavigationHandle. See the
+// ServiceWorkerNavigationHandle header for more details about the lifetime of
+// both classes.
+class ServiceWorkerNavigationHandleCore {
+ public:
+ ServiceWorkerNavigationHandleCore(
+ base::WeakPtr<ServiceWorkerNavigationHandle> ui_handle,
+ ServiceWorkerContextWrapper* context_wrapper);
+
+ // Called from the UI thread to destroy this object on the IO thread.
+ void Destroy();
+
+ // Called when a ServiceWorkerProviderHost was pre-created for the navigation
+ // tracked by this ServiceWorkerNavigationHandleCore. Takes ownership of
+ // |precreated_host|.
+ void DidPreCreateProviderHost(
+ scoped_ptr<ServiceWorkerProviderHost> precreated_host);
+
+ // Called when the renderer created a ServiceWorkerNetworkProvider matching
+ // |precreated_host_|. This releases ownership of |precreated_host_|.
+ scoped_ptr<ServiceWorkerProviderHost> RetrievePreCreatedHost();
+
+ ServiceWorkerContextWrapper* context_wrapper() const {
+ return context_wrapper_.get();
+ }
+
+ private:
+ ~ServiceWorkerNavigationHandleCore();
+
+ scoped_ptr<ServiceWorkerProviderHost> precreated_host_;
+ scoped_refptr<ServiceWorkerContextWrapper> context_wrapper_;
+ base::WeakPtr<ServiceWorkerNavigationHandle> ui_handle_;
+
+ DISALLOW_COPY_AND_ASSIGN(ServiceWorkerNavigationHandleCore);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_NAVIGATION_HANDLE_CORE_H_

Powered by Google App Engine
This is Rietveld 408576698