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

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

Issue 1478103002: [WIP] [service worker] Fix detach controller and fallback to network mechanism (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: return null in Create/Adopt Created 5 years 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
« no previous file with comments | « no previous file | content/child/service_worker/service_worker_dispatcher_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 g_dispatcher_tls.Pointer()->Get()); 257 g_dispatcher_tls.Pointer()->Get());
258 } 258 }
259 259
260 void ServiceWorkerDispatcher::WillStopCurrentWorkerThread() { 260 void ServiceWorkerDispatcher::WillStopCurrentWorkerThread() {
261 delete this; 261 delete this;
262 } 262 }
263 263
264 scoped_refptr<WebServiceWorkerImpl> 264 scoped_refptr<WebServiceWorkerImpl>
265 ServiceWorkerDispatcher::GetOrCreateServiceWorker( 265 ServiceWorkerDispatcher::GetOrCreateServiceWorker(
266 scoped_ptr<ServiceWorkerHandleReference> handle_ref) { 266 scoped_ptr<ServiceWorkerHandleReference> handle_ref) {
267 if (handle_ref->handle_id() == kInvalidServiceWorkerHandleId) 267 if (!handle_ref)
268 return nullptr; 268 return nullptr;
269 269
270 WorkerObjectMap::iterator found = 270 WorkerObjectMap::iterator found =
271 service_workers_.find(handle_ref->handle_id()); 271 service_workers_.find(handle_ref->handle_id());
272 if (found != service_workers_.end()) 272 if (found != service_workers_.end())
273 return found->second; 273 return found->second;
274 274
275 // WebServiceWorkerImpl constructor calls AddServiceWorker. 275 // WebServiceWorkerImpl constructor calls AddServiceWorker.
276 return new WebServiceWorkerImpl(handle_ref.Pass(), thread_safe_sender_.get()); 276 return new WebServiceWorkerImpl(handle_ref.Pass(), thread_safe_sender_.get());
277 } 277 }
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 return ServiceWorkerRegistrationHandleReference::Adopt( 762 return ServiceWorkerRegistrationHandleReference::Adopt(
763 info, thread_safe_sender_.get()); 763 info, thread_safe_sender_.get());
764 } 764 }
765 765
766 scoped_ptr<ServiceWorkerHandleReference> ServiceWorkerDispatcher::Adopt( 766 scoped_ptr<ServiceWorkerHandleReference> ServiceWorkerDispatcher::Adopt(
767 const ServiceWorkerObjectInfo& info) { 767 const ServiceWorkerObjectInfo& info) {
768 return ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get()); 768 return ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get());
769 } 769 }
770 770
771 } // namespace content 771 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/child/service_worker/service_worker_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698