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

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: 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..4cae74c53cc7debd0237bed572bf147d6d0e9b55 100644
--- a/content/child/service_worker/service_worker_dispatcher.cc
+++ b/content/child/service_worker/service_worker_dispatcher.cc
@@ -33,7 +33,8 @@ int CurrentWorkerId() {
ServiceWorkerDispatcher::ServiceWorkerDispatcher(
ThreadSafeSender* thread_safe_sender)
- : thread_safe_sender_(thread_safe_sender) {
+ : thread_safe_sender_(thread_safe_sender),
+ client_(NULL) {
g_dispatcher_tls.Pointer()->Set(this);
}
@@ -77,6 +78,21 @@ void ServiceWorkerDispatcher::UnregisterServiceWorker(
CurrentWorkerId(), request_id, pattern));
}
+void ServiceWorkerDispatcher::SetScriptClient(
+ int provider_id,
+ blink::WebServiceWorkerProviderClient* client) {
+ if (client) {
+ DCHECK(!client_);
+ thread_safe_sender_->Send(new ServiceWorkerHostMsg_AddScriptClient(
+ CurrentWorkerId(), provider_id));
+ } else {
+ DCHECK(client_);
+ thread_safe_sender_->Send(new ServiceWorkerHostMsg_RemoveScriptClient(
+ CurrentWorkerId(), provider_id));
+ }
+ client_ = client;
michaeln 2014/03/07 01:26:23 This class is used on the main thread where we'll
kinuko 2014/03/07 02:02:17 Oops, that's right, I have focused too much on wor
+}
+
ServiceWorkerDispatcher* ServiceWorkerDispatcher::ThreadSpecificInstance(
ThreadSafeSender* thread_safe_sender) {
if (g_dispatcher_tls.Pointer()->Get() == kHasBeenDeleted) {

Powered by Google App Engine
This is Rietveld 408576698