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

Side by Side Diff: content/child/service_worker/service_worker_dispatcher.cc

Issue 189253002: Implement ServiceWorker::postMessage() [Chromium] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename message handler per review feedback 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/service_worker/service_worker_dispatcher.h" 5 #include "content/child/service_worker/service_worker_dispatcher.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/threading/thread_local.h" 8 #include "base/threading/thread_local.h"
9 #include "content/child/service_worker/web_service_worker_impl.h" 9 #include "content/child/service_worker/web_service_worker_impl.h"
10 #include "content/child/thread_safe_sender.h" 10 #include "content/child/thread_safe_sender.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 if (!callbacks) 121 if (!callbacks)
122 return; 122 return;
123 123
124 // the browser has to generate the registration_id so the same 124 // the browser has to generate the registration_id so the same
125 // worker can be called from different renderer contexts. However, 125 // worker can be called from different renderer contexts. However,
126 // the impl object doesn't have to be the same instance across calls 126 // the impl object doesn't have to be the same instance across calls
127 // unless we require the DOM objects to be identical when there's a 127 // unless we require the DOM objects to be identical when there's a
128 // duplicate registration. So for now we mint a new object each 128 // duplicate registration. So for now we mint a new object each
129 // time. 129 // time.
130 scoped_ptr<WebServiceWorkerImpl> worker( 130 scoped_ptr<WebServiceWorkerImpl> worker(
131 new WebServiceWorkerImpl(registration_id)); 131 new WebServiceWorkerImpl(registration_id, thread_safe_sender_));
132 callbacks->onSuccess(worker.release()); 132 callbacks->onSuccess(worker.release());
133 pending_callbacks_.Remove(request_id); 133 pending_callbacks_.Remove(request_id);
134 } 134 }
135 135
136 void ServiceWorkerDispatcher::OnUnregistered( 136 void ServiceWorkerDispatcher::OnUnregistered(
137 int32 thread_id, 137 int32 thread_id,
138 int32 request_id) { 138 int32 request_id) {
139 WebServiceWorkerProvider::WebServiceWorkerCallbacks* callbacks = 139 WebServiceWorkerProvider::WebServiceWorkerCallbacks* callbacks =
140 pending_callbacks_.Lookup(request_id); 140 pending_callbacks_.Lookup(request_id);
141 DCHECK(callbacks); 141 DCHECK(callbacks);
(...skipping 17 matching lines...) Expand all
159 159
160 scoped_ptr<WebServiceWorkerError> error( 160 scoped_ptr<WebServiceWorkerError> error(
161 new WebServiceWorkerError(error_type, message)); 161 new WebServiceWorkerError(error_type, message));
162 callbacks->onError(error.release()); 162 callbacks->onError(error.release());
163 pending_callbacks_.Remove(request_id); 163 pending_callbacks_.Remove(request_id);
164 } 164 }
165 165
166 void ServiceWorkerDispatcher::OnWorkerRunLoopStopped() { delete this; } 166 void ServiceWorkerDispatcher::OnWorkerRunLoopStopped() { delete this; }
167 167
168 } // namespace content 168 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_storage.cc ('k') | content/child/service_worker/web_service_worker_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698