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

Unified Diff: content/child/service_worker/service_worker_dispatcher.cc

Issue 182863004: Wire provider_id into scriptable API provider to start listening events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove TODO/debug logs Created 6 years, 9 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/child/service_worker/service_worker_dispatcher.cc
diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc
index b9da048c199071bdf1ae92aac9ba74b5bd824860..0a4310edc1c2f202f1c89eafe66a7d4987737562 100644
--- a/content/child/service_worker/service_worker_dispatcher.cc
+++ b/content/child/service_worker/service_worker_dispatcher.cc
@@ -77,6 +77,25 @@ void ServiceWorkerDispatcher::UnregisterServiceWorker(
CurrentWorkerId(), request_id, pattern));
}
+void ServiceWorkerDispatcher::AddScriptClient(
+ int provider_id,
+ blink::WebServiceWorkerProviderClient* client) {
+ DCHECK(client);
+ DCHECK(!ContainsKey(script_clients_, provider_id));
+ script_clients_[provider_id] = client;
+ thread_safe_sender_->Send(new ServiceWorkerHostMsg_AddScriptClient(
+ CurrentWorkerId(), provider_id));
+}
+
+void ServiceWorkerDispatcher::RemoveScriptClient(int provider_id) {
+ // This could be possibly called multiple times to ensure termination.
+ if (ContainsKey(script_clients_, provider_id)) {
+ script_clients_.erase(provider_id);
+ thread_safe_sender_->Send(new ServiceWorkerHostMsg_RemoveScriptClient(
+ CurrentWorkerId(), provider_id));
+ }
+}
+
ServiceWorkerDispatcher* ServiceWorkerDispatcher::ThreadSpecificInstance(
ThreadSafeSender* thread_safe_sender) {
if (g_dispatcher_tls.Pointer()->Get() == kHasBeenDeleted) {

Powered by Google App Engine
This is Rietveld 408576698