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

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

Issue 317953004: Set the "waiting" Service Worker of Service Worker providers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bring patch to head. Created 6 years, 6 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/web_service_worker_provider_impl.h" 5 #include "content/child/service_worker/web_service_worker_provider_impl.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/child/child_thread.h" 9 #include "content/child/child_thread.h"
10 #include "content/child/service_worker/service_worker_dispatcher.h" 10 #include "content/child/service_worker/service_worker_dispatcher.h"
(...skipping 29 matching lines...) Expand all
40 return; 40 return;
41 } 41 }
42 42
43 // TODO(kinuko): Here we could also register the current thread ID 43 // TODO(kinuko): Here we could also register the current thread ID
44 // on the provider context so that multiple WebServiceWorkerProviderImpl 44 // on the provider context so that multiple WebServiceWorkerProviderImpl
45 // (e.g. on document and on dedicated workers) can properly share 45 // (e.g. on document and on dedicated workers) can properly share
46 // the single provider context across threads. (http://crbug.com/366538 46 // the single provider context across threads. (http://crbug.com/366538
47 // for more context) 47 // for more context)
48 GetDispatcher()->AddScriptClient(provider_id_, client); 48 GetDispatcher()->AddScriptClient(provider_id_, client);
49 49
50 int handle_id = context_->current_handle_id(); 50 if (context_->waiting_handle_id() != kInvalidServiceWorkerHandleId) {
51 if (handle_id == kInvalidServiceWorkerHandleId) 51 client->setWaiting(
52 return; 52 GetDispatcher()->GetServiceWorker(context_->waiting()->info(), false));
53 }
53 54
54 client->setCurrentServiceWorker( 55 if (context_->current_handle_id() != kInvalidServiceWorkerHandleId) {
55 GetDispatcher()->GetServiceWorker(context_->current()->info(), false)); 56 client->setController(
57 GetDispatcher()->GetServiceWorker(context_->current()->info(), false));
58 }
56 } 59 }
57 60
58 void WebServiceWorkerProviderImpl::registerServiceWorker( 61 void WebServiceWorkerProviderImpl::registerServiceWorker(
59 const WebURL& pattern, 62 const WebURL& pattern,
60 const WebURL& script_url, 63 const WebURL& script_url,
61 WebServiceWorkerCallbacks* callbacks) { 64 WebServiceWorkerCallbacks* callbacks) {
62 GetDispatcher()->RegisterServiceWorker( 65 GetDispatcher()->RegisterServiceWorker(
63 provider_id_, pattern, script_url, callbacks); 66 provider_id_, pattern, script_url, callbacks);
64 } 67 }
65 68
(...skipping 12 matching lines...) Expand all
78 if (dispatcher) 81 if (dispatcher)
79 dispatcher->RemoveScriptClient(provider_id_); 82 dispatcher->RemoveScriptClient(provider_id_);
80 } 83 }
81 84
82 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { 85 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() {
83 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( 86 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance(
84 thread_safe_sender_); 87 thread_safe_sender_);
85 } 88 }
86 89
87 } // namespace content 90 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698