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

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

Issue 255813003: ServiceWorker: Queue worker state changes until Blink is ready for them (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: include style Created 6 years, 7 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/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/threading/thread_local.h" 9 #include "base/threading/thread_local.h"
10 #include "content/child/service_worker/web_service_worker_impl.h" 10 #include "content/child/service_worker/web_service_worker_impl.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 pending_callbacks_.Remove(request_id); 191 pending_callbacks_.Remove(request_id);
192 } 192 }
193 193
194 void ServiceWorkerDispatcher::OnServiceWorkerStateChanged( 194 void ServiceWorkerDispatcher::OnServiceWorkerStateChanged(
195 int thread_id, 195 int thread_id,
196 int handle_id, 196 int handle_id,
197 blink::WebServiceWorkerState state) { 197 blink::WebServiceWorkerState state) {
198 ServiceWorkerMap::iterator found = service_workers_.find(handle_id); 198 ServiceWorkerMap::iterator found = service_workers_.find(handle_id);
199 if (found == service_workers_.end()) 199 if (found == service_workers_.end())
200 return; 200 return;
201 found->second->SetState(state); 201 found->second->OnStateChanged(state);
202 } 202 }
203 203
204 void ServiceWorkerDispatcher::OnSetCurrentServiceWorker( 204 void ServiceWorkerDispatcher::OnSetCurrentServiceWorker(
205 int thread_id, 205 int thread_id,
206 int provider_id, 206 int provider_id,
207 const ServiceWorkerObjectInfo& info) { 207 const ServiceWorkerObjectInfo& info) {
208 scoped_ptr<WebServiceWorkerImpl> worker( 208 scoped_ptr<WebServiceWorkerImpl> worker(
209 new WebServiceWorkerImpl(info, thread_safe_sender_)); 209 new WebServiceWorkerImpl(info, thread_safe_sender_));
210 ScriptClientMap::iterator found = script_clients_.find(provider_id); 210 ScriptClientMap::iterator found = script_clients_.find(provider_id);
211 if (found == script_clients_.end()) { 211 if (found == script_clients_.end()) {
(...skipping 11 matching lines...) Expand all
223 DCHECK(!ContainsKey(service_workers_, handle_id)); 223 DCHECK(!ContainsKey(service_workers_, handle_id));
224 service_workers_[handle_id] = worker; 224 service_workers_[handle_id] = worker;
225 } 225 }
226 226
227 void ServiceWorkerDispatcher::RemoveServiceWorker(int handle_id) { 227 void ServiceWorkerDispatcher::RemoveServiceWorker(int handle_id) {
228 DCHECK(ContainsKey(service_workers_, handle_id)); 228 DCHECK(ContainsKey(service_workers_, handle_id));
229 service_workers_.erase(handle_id); 229 service_workers_.erase(handle_id);
230 } 230 }
231 231
232 } // namespace content 232 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698