OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/renderer/service_worker/service_worker_context_client.h" | 5 #include "content/renderer/service_worker/service_worker_context_client.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 return web_client_info; | 165 return web_client_info; |
166 } | 166 } |
167 | 167 |
168 } // namespace | 168 } // namespace |
169 | 169 |
170 // Holding data that needs to be bound to the worker context on the | 170 // Holding data that needs to be bound to the worker context on the |
171 // worker thread. | 171 // worker thread. |
172 struct ServiceWorkerContextClient::WorkerContextData { | 172 struct ServiceWorkerContextClient::WorkerContextData { |
173 using ClientsCallbacksMap = | 173 using ClientsCallbacksMap = |
174 IDMap<blink::WebServiceWorkerClientsCallbacks, IDMapOwnPointer>; | 174 IDMap<std::unique_ptr<blink::WebServiceWorkerClientsCallbacks>>; |
175 using ClaimClientsCallbacksMap = | 175 using ClaimClientsCallbacksMap = |
176 IDMap<blink::WebServiceWorkerClientsClaimCallbacks, IDMapOwnPointer>; | 176 IDMap<std::unique_ptr<blink::WebServiceWorkerClientsClaimCallbacks>>; |
177 using ClientCallbacksMap = | 177 using ClientCallbacksMap = |
178 IDMap<blink::WebServiceWorkerClientCallbacks, IDMapOwnPointer>; | 178 IDMap<std::unique_ptr<blink::WebServiceWorkerClientCallbacks>>; |
179 using SkipWaitingCallbacksMap = | 179 using SkipWaitingCallbacksMap = |
180 IDMap<blink::WebServiceWorkerSkipWaitingCallbacks, IDMapOwnPointer>; | 180 IDMap<std::unique_ptr<blink::WebServiceWorkerSkipWaitingCallbacks>>; |
181 using SyncEventCallbacksMap = IDMap<const SyncCallback, IDMapOwnPointer>; | 181 using SyncEventCallbacksMap = IDMap<std::unique_ptr<const SyncCallback>>; |
182 using FetchEventCallbacksMap = IDMap<const FetchCallback, IDMapOwnPointer>; | 182 using FetchEventCallbacksMap = IDMap<std::unique_ptr<const FetchCallback>>; |
183 using NavigationPreloadRequestsMap = | 183 using NavigationPreloadRequestsMap = IDMap< |
184 IDMap<ServiceWorkerContextClient::NavigationPreloadRequest, | 184 std::unique_ptr<ServiceWorkerContextClient::NavigationPreloadRequest>>; |
185 IDMapOwnPointer>; | |
186 | 185 |
187 explicit WorkerContextData(ServiceWorkerContextClient* owner) | 186 explicit WorkerContextData(ServiceWorkerContextClient* owner) |
188 : event_dispatcher_binding(owner), | 187 : event_dispatcher_binding(owner), |
189 weak_factory(owner), | 188 weak_factory(owner), |
190 proxy_weak_factory(owner->proxy_) {} | 189 proxy_weak_factory(owner->proxy_) {} |
191 | 190 |
192 ~WorkerContextData() { | 191 ~WorkerContextData() { |
193 DCHECK(thread_checker.CalledOnValidThread()); | 192 DCHECK(thread_checker.CalledOnValidThread()); |
194 } | 193 } |
195 | 194 |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 } | 1272 } |
1274 | 1273 |
1275 base::WeakPtr<ServiceWorkerContextClient> | 1274 base::WeakPtr<ServiceWorkerContextClient> |
1276 ServiceWorkerContextClient::GetWeakPtr() { | 1275 ServiceWorkerContextClient::GetWeakPtr() { |
1277 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1276 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
1278 DCHECK(context_); | 1277 DCHECK(context_); |
1279 return context_->weak_factory.GetWeakPtr(); | 1278 return context_->weak_factory.GetWeakPtr(); |
1280 } | 1279 } |
1281 | 1280 |
1282 } // namespace content | 1281 } // namespace content |
OLD | NEW |