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

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

Issue 1469123003: ServiceWorker: Ensure that ServiceWorkerDispatcher always adopts passed handle references (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test 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 | « content/child/service_worker/service_worker_handle_reference.h ('k') | no next file » | 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/web_service_worker_provider_impl.h" 5 #include "content/child/service_worker/web_service_worker_provider_impl.h"
6 6
7 #include "content/child/service_worker/service_worker_dispatcher.h" 7 #include "content/child/service_worker/service_worker_dispatcher.h"
8 #include "content/child/service_worker/service_worker_handle_reference.h" 8 #include "content/child/service_worker/service_worker_handle_reference.h"
9 #include "content/child/service_worker/service_worker_provider_context.h" 9 #include "content/child/service_worker/service_worker_provider_context.h"
10 #include "content/child/service_worker/web_service_worker_impl.h" 10 #include "content/child/service_worker/web_service_worker_impl.h"
(...skipping 29 matching lines...) Expand all
40 // TODO(kinuko): Here we could also register the current thread ID 40 // TODO(kinuko): Here we could also register the current thread ID
41 // on the provider context so that multiple WebServiceWorkerProviderImpl 41 // on the provider context so that multiple WebServiceWorkerProviderImpl
42 // (e.g. on document and on dedicated workers) can properly share 42 // (e.g. on document and on dedicated workers) can properly share
43 // the single provider context across threads. (http://crbug.com/366538 43 // the single provider context across threads. (http://crbug.com/366538
44 // for more context) 44 // for more context)
45 GetDispatcher()->AddProviderClient(context_->provider_id(), client); 45 GetDispatcher()->AddProviderClient(context_->provider_id(), client);
46 46
47 if (!context_->controller()) 47 if (!context_->controller())
48 return; 48 return;
49 scoped_refptr<WebServiceWorkerImpl> controller = 49 scoped_refptr<WebServiceWorkerImpl> controller =
50 GetDispatcher()->GetOrCreateServiceWorker(context_->controller()->info()); 50 GetDispatcher()->GetOrCreateServiceWorker(
51 ServiceWorkerHandleReference::Create(context_->controller()->info(),
52 thread_safe_sender_.get()));
51 client->setController(WebServiceWorkerImpl::CreateHandle(controller), 53 client->setController(WebServiceWorkerImpl::CreateHandle(controller),
52 false /* shouldNotifyControllerChange */); 54 false /* shouldNotifyControllerChange */);
53 } 55 }
54 56
55 void WebServiceWorkerProviderImpl::registerServiceWorker( 57 void WebServiceWorkerProviderImpl::registerServiceWorker(
56 const WebURL& pattern, 58 const WebURL& pattern,
57 const WebURL& script_url, 59 const WebURL& script_url,
58 WebServiceWorkerRegistrationCallbacks* callbacks) { 60 WebServiceWorkerRegistrationCallbacks* callbacks) {
59 GetDispatcher()->RegisterServiceWorker( 61 GetDispatcher()->RegisterServiceWorker(
60 context_->provider_id(), pattern, script_url, callbacks); 62 context_->provider_id(), pattern, script_url, callbacks);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 ServiceWorkerDispatcher::GetThreadSpecificInstance(); 103 ServiceWorkerDispatcher::GetThreadSpecificInstance();
102 if (dispatcher) 104 if (dispatcher)
103 dispatcher->RemoveProviderClient(context_->provider_id()); 105 dispatcher->RemoveProviderClient(context_->provider_id());
104 } 106 }
105 107
106 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { 108 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() {
107 return ServiceWorkerDispatcher::GetThreadSpecificInstance(); 109 return ServiceWorkerDispatcher::GetThreadSpecificInstance();
108 } 110 }
109 111
110 } // namespace content 112 } // namespace content
OLDNEW
« no previous file with comments | « content/child/service_worker/service_worker_handle_reference.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698