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

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

Issue 2934163003: Add a ServiceWorkerContextObserver to content's public API. (Closed)
Patch Set: Clarifying comment Created 3 years, 6 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
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_context_wrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_context_wrapper.h
diff --git a/content/browser/service_worker/service_worker_context_wrapper.h b/content/browser/service_worker/service_worker_context_wrapper.h
index 961d5da10580cc94ebd7d5333b4b467816951f7d..71ea538a46d7f45c13f3e5c8ecf22f73b3ab437e 100644
--- a/content/browser/service_worker/service_worker_context_wrapper.h
+++ b/content/browser/service_worker/service_worker_context_wrapper.h
@@ -11,10 +11,12 @@
#include <string>
#include <vector>
-#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/observer_list.h"
+#include "base/observer_list_threadsafe.h"
#include "content/browser/service_worker/service_worker_context_core.h"
+#include "content/browser/service_worker/service_worker_context_core_observer.h"
#include "content/common/content_export.h"
#include "content/common/worker_url_loader_factory_provider.mojom.h"
#include "content/public/browser/service_worker_context.h"
@@ -33,8 +35,7 @@ namespace content {
class BrowserContext;
class ResourceContext;
-class ServiceWorkerContextCore;
-class ServiceWorkerContextCoreObserver;
+class ServiceWorkerContextObserver;
class StoragePartitionImpl;
// A refcounted wrapper class for our core object. Higher level content lib
@@ -43,6 +44,7 @@ class StoragePartitionImpl;
// is what is used internally in the service worker lib.
class CONTENT_EXPORT ServiceWorkerContextWrapper
: NON_EXPORTED_BASE(public ServiceWorkerContext),
+ public ServiceWorkerContextCoreObserver,
public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> {
public:
using StatusCallback = base::Callback<void(ServiceWorkerStatusCode)>;
@@ -88,7 +90,13 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
return process_manager_.get();
}
+ // ServiceWorkerContextCoreObserver implementation:
+ void OnRegistrationStored(int64_t registration_id,
+ const GURL& pattern) override;
+
// ServiceWorkerContext implementation:
+ void AddObserver(ServiceWorkerContextObserver* observer) override;
+ void RemoveObserver(ServiceWorkerContextObserver* observer) override;
void RegisterServiceWorker(const GURL& pattern,
const GURL& script_url,
const ResultCallback& continuation) override;
@@ -284,9 +292,16 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
// DeleteAndStartOver fails.
ServiceWorkerContextCore* context();
+ // Observers of |context_core_| which live within content's implementation
+ // boundary. Shared with |context_core_|.
const scoped_refptr<
base::ObserverListThreadSafe<ServiceWorkerContextCoreObserver>>
core_observer_list_;
+
+ // Observers which live outside content's implementation boundary. Observer
+ // methods will always be dispatched on the UI thread.
+ base::ObserverList<ServiceWorkerContextObserver> observer_list_;
+
const std::unique_ptr<ServiceWorkerProcessManager> process_manager_;
// Cleared in ShutdownOnIO():
std::unique_ptr<ServiceWorkerContextCore> context_core_;
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_context_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698