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

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

Issue 62203007: Implement memory-persistent registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix variable that we don't need anymore Created 7 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/service_worker/service_worker_context_core.h
diff --git a/content/browser/service_worker/service_worker_context_core.h b/content/browser/service_worker/service_worker_context_core.h
index 8d6f44250d5da1540880d293bfd9162b0fc16c15..854e23404302316a68bddad42b3088d857f795d4 100644
--- a/content/browser/service_worker/service_worker_context_core.h
+++ b/content/browser/service_worker/service_worker_context_core.h
@@ -5,13 +5,20 @@
#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_
#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_
+#include <map>
+
+#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/id_map.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "content/browser/service_worker/service_worker_provider_host.h"
+#include "content/browser/service_worker/service_worker_registration_status.h"
+#include "content/browser/service_worker/service_worker_storage.h"
#include "content/common/content_export.h"
+class GURL;
+
namespace base {
class FilePath;
}
@@ -22,6 +29,8 @@ class QuotaManagerProxy;
namespace content {
+class ServiceWorkerStorage;
+class ServiceWorkerRegistration;
class ServiceWorkerProviderHost;
// This class manages data associated with service workers.
@@ -33,11 +42,20 @@ class CONTENT_EXPORT ServiceWorkerContextCore
: NON_EXPORTED_BASE(
public base::SupportsWeakPtr<ServiceWorkerContextCore>) {
public:
- // Given an empty |user_data_directory|, nothing will be stored on disk.
+ typedef base::Callback<void(ServiceWorkerRegistrationStatus status,
+ int64 registration_id)> RegistrationCallback;
+ typedef base::Callback<
+ void(ServiceWorkerRegistrationStatus status)> UnregistrationCallback;
+
+ // This is owned by the StoragePartition, which will supply it with
+ // the local path on disk. Given an empty |user_data_directory|,
+ // nothing will be stored on disk.
ServiceWorkerContextCore(const base::FilePath& user_data_directory,
quota::QuotaManagerProxy* quota_manager_proxy);
~ServiceWorkerContextCore();
+ ServiceWorkerStorage* storage() { return storage_.get(); }
+
// The context class owns the set of ProviderHosts.
ServiceWorkerProviderHost* GetProviderHost(int process_id, int provider_id);
void AddProviderHost(scoped_ptr<ServiceWorkerProviderHost> provider_host);
@@ -47,6 +65,15 @@ class CONTENT_EXPORT ServiceWorkerContextCore
// Checks the cmdline flag.
bool IsEnabled();
+ // The callback will be called on the IO thread.
+ void RegisterServiceWorker(const GURL& pattern,
+ const GURL& script_url,
+ const RegistrationCallback& callback);
+
+ // The callback will be called on the IO thread.
+ void UnregisterServiceWorker(const GURL& pattern,
+ const UnregistrationCallback& callback);
+
private:
typedef IDMap<ServiceWorkerProviderHost, IDMapOwnPointer> ProviderMap;
typedef IDMap<ProviderMap, IDMapOwnPointer> ProcessToProviderMap;
@@ -55,9 +82,17 @@ class CONTENT_EXPORT ServiceWorkerContextCore
return providers_.Lookup(process_id);
}
+ void RegistrationComplete(
+ const RegistrationCallback& callback,
+ ServiceWorkerRegistrationStatus status,
+ const scoped_refptr<ServiceWorkerRegistration>& registration);
+ void UnregistrationComplete(const UnregistrationCallback& callback,
+ ServiceWorkerRegistrationStatus status);
+
ProcessToProviderMap providers_;
- scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_;
- base::FilePath path_;
+ scoped_ptr<ServiceWorkerStorage> storage_;
+
+ DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore);
};
} // namespace content
« no previous file with comments | « content/browser/service_worker/service_worker_context.h ('k') | content/browser/service_worker/service_worker_context_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698