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/browser/service_worker/service_worker_provider_host.h" | 5 #include "content/browser/service_worker/service_worker_provider_host.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "content/browser/message_port_message_filter.h" | 8 #include "content/browser/message_port_message_filter.h" |
9 #include "content/browser/service_worker/service_worker_context_core.h" | 9 #include "content/browser/service_worker/service_worker_context_core.h" |
10 #include "content/browser/service_worker/service_worker_context_request_handler.
h" | 10 #include "content/browser/service_worker/service_worker_context_request_handler.
h" |
11 #include "content/browser/service_worker/service_worker_controllee_request_handl
er.h" | 11 #include "content/browser/service_worker/service_worker_controllee_request_handl
er.h" |
12 #include "content/browser/service_worker/service_worker_dispatcher_host.h" | 12 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
13 #include "content/browser/service_worker/service_worker_handle.h" | 13 #include "content/browser/service_worker/service_worker_handle.h" |
| 14 #include "content/browser/service_worker/service_worker_registration_handle.h" |
14 #include "content/browser/service_worker/service_worker_utils.h" | 15 #include "content/browser/service_worker/service_worker_utils.h" |
15 #include "content/browser/service_worker/service_worker_version.h" | 16 #include "content/browser/service_worker/service_worker_version.h" |
16 #include "content/common/service_worker/service_worker_messages.h" | 17 #include "content/common/service_worker/service_worker_messages.h" |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 static const int kDocumentMainThreadId = 0; | 21 static const int kDocumentMainThreadId = 0; |
21 | 22 |
22 ServiceWorkerProviderHost::ServiceWorkerProviderHost( | 23 ServiceWorkerProviderHost::ServiceWorkerProviderHost( |
23 int process_id, int provider_id, | 24 int process_id, int provider_id, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 93 |
93 ServiceWorkerVersionAttributes attributes; | 94 ServiceWorkerVersionAttributes attributes; |
94 if (mask.installing_changed()) | 95 if (mask.installing_changed()) |
95 attributes.installing = CreateHandleAndPass(installing_version); | 96 attributes.installing = CreateHandleAndPass(installing_version); |
96 if (mask.waiting_changed()) | 97 if (mask.waiting_changed()) |
97 attributes.waiting = CreateHandleAndPass(waiting_version); | 98 attributes.waiting = CreateHandleAndPass(waiting_version); |
98 if (mask.active_changed()) | 99 if (mask.active_changed()) |
99 attributes.active = CreateHandleAndPass(active_version); | 100 attributes.active = CreateHandleAndPass(active_version); |
100 | 101 |
101 dispatcher_host_->Send(new ServiceWorkerMsg_SetVersionAttributes( | 102 dispatcher_host_->Send(new ServiceWorkerMsg_SetVersionAttributes( |
102 kDocumentMainThreadId, provider_id(), mask.changed(), attributes)); | 103 kDocumentMainThreadId, |
| 104 provider_id(), |
| 105 kInvalidServiceWorkerRegistrationHandleId, |
| 106 mask.changed(), |
| 107 attributes)); |
103 } | 108 } |
104 | 109 |
105 void ServiceWorkerProviderHost::SetVersionAttributesInternal( | 110 void ServiceWorkerProviderHost::SetVersionAttributesInternal( |
106 ServiceWorkerVersion* version, | 111 ServiceWorkerVersion* version, |
107 scoped_refptr<ServiceWorkerVersion>* data_member) { | 112 scoped_refptr<ServiceWorkerVersion>* data_member) { |
108 scoped_refptr<ServiceWorkerVersion> previous_version = *data_member; | 113 scoped_refptr<ServiceWorkerVersion> previous_version = *data_member; |
109 *data_member = version; | 114 *data_member = version; |
110 if (version) | 115 if (version) |
111 version->AddPotentialControllee(this); | 116 version->AddPotentialControllee(this); |
112 if (previous_version) | 117 if (previous_version) |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 dispatcher_host_->RegisterServiceWorkerHandle(handle.Pass()); | 245 dispatcher_host_->RegisterServiceWorkerHandle(handle.Pass()); |
241 } | 246 } |
242 return info; | 247 return info; |
243 } | 248 } |
244 | 249 |
245 bool ServiceWorkerProviderHost::IsContextAlive() { | 250 bool ServiceWorkerProviderHost::IsContextAlive() { |
246 return context_ != NULL; | 251 return context_ != NULL; |
247 } | 252 } |
248 | 253 |
249 } // namespace content | 254 } // namespace content |
OLD | NEW |