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

Unified Diff: content/child/service_worker/web_service_worker_provider_impl.cc

Issue 309503014: Make ServiceWorkerDispatcher reuse existing WebServiceWorkerImpls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Correct comment. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/service_worker/web_service_worker_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/service_worker/web_service_worker_provider_impl.cc
diff --git a/content/child/service_worker/web_service_worker_provider_impl.cc b/content/child/service_worker/web_service_worker_provider_impl.cc
index 407552d0220cfd629dddd555741c7fbeb85b8d50..8b89c43f267c66ae4b9b1e25c5a75b5d2286823d 100644
--- a/content/child/service_worker/web_service_worker_provider_impl.cc
+++ b/content/child/service_worker/web_service_worker_provider_impl.cc
@@ -45,18 +45,14 @@ void WebServiceWorkerProviderImpl::setClient(
// (e.g. on document and on dedicated workers) can properly share
// the single provider context across threads. (http://crbug.com/366538
// for more context)
- scoped_ptr<ServiceWorkerHandleReference> current =
- context_->GetCurrentServiceWorkerHandle();
GetDispatcher()->AddScriptClient(provider_id_, client);
- if (!current)
+
+ int handle_id = context_->current_handle_id();
+ if (handle_id == kInvalidServiceWorkerHandleId)
return;
- int handle_id = current->info().handle_id;
- if (handle_id != kInvalidServiceWorkerHandleId) {
- scoped_ptr<WebServiceWorkerImpl> worker(
- new WebServiceWorkerImpl(current.Pass(), thread_safe_sender_));
- client->setCurrentServiceWorker(worker.release());
- }
+ client->setCurrentServiceWorker(
+ GetDispatcher()->GetServiceWorker(context_->current()->info(), false));
}
void WebServiceWorkerProviderImpl::registerServiceWorker(
« no previous file with comments | « content/child/service_worker/web_service_worker_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698