OLD | NEW |
---|---|
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 Loading... | |
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)); |
falken
2014/06/10 20:34:28
as the body is more than a single line, the if sta
| |
53 | 53 |
54 client->setCurrentServiceWorker( | 54 if (context_->current_handle_id() != kInvalidServiceWorkerHandleId) |
55 GetDispatcher()->GetServiceWorker(context_->current()->info(), false)); | 55 client->setController( |
56 GetDispatcher()->GetServiceWorker(context_->current()->info(), false)); | |
falken
2014/06/10 20:34:28
here too
| |
56 } | 57 } |
57 | 58 |
58 void WebServiceWorkerProviderImpl::registerServiceWorker( | 59 void WebServiceWorkerProviderImpl::registerServiceWorker( |
59 const WebURL& pattern, | 60 const WebURL& pattern, |
60 const WebURL& script_url, | 61 const WebURL& script_url, |
61 WebServiceWorkerCallbacks* callbacks) { | 62 WebServiceWorkerCallbacks* callbacks) { |
62 GetDispatcher()->RegisterServiceWorker( | 63 GetDispatcher()->RegisterServiceWorker( |
63 provider_id_, pattern, script_url, callbacks); | 64 provider_id_, pattern, script_url, callbacks); |
64 } | 65 } |
65 | 66 |
(...skipping 12 matching lines...) Expand all Loading... | |
78 if (dispatcher) | 79 if (dispatcher) |
79 dispatcher->RemoveScriptClient(provider_id_); | 80 dispatcher->RemoveScriptClient(provider_id_); |
80 } | 81 } |
81 | 82 |
82 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { | 83 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { |
83 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( | 84 return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( |
84 thread_safe_sender_); | 85 thread_safe_sender_); |
85 } | 86 } |
86 | 87 |
87 } // namespace content | 88 } // namespace content |
OLD | NEW |