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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 mojo::MakeStrongBinding(base::MakeUnique<FetchEventDispatcherImpl>(), | 230 mojo::MakeStrongBinding(base::MakeUnique<FetchEventDispatcherImpl>(), |
231 std::move(request)); | 231 std::move(request)); |
232 } | 232 } |
233 | 233 |
234 FetchEventDispatcherImpl() {} | 234 FetchEventDispatcherImpl() {} |
235 | 235 |
236 ~FetchEventDispatcherImpl() override {} | 236 ~FetchEventDispatcherImpl() override {} |
237 | 237 |
238 void DispatchFetchEvent(int fetch_event_id, | 238 void DispatchFetchEvent(int fetch_event_id, |
239 const ServiceWorkerFetchRequest& request, | 239 const ServiceWorkerFetchRequest& request, |
| 240 mojom::FetchEventPreloadHandlePtr preload_handle, |
240 const DispatchFetchEventCallback& callback) override { | 241 const DispatchFetchEventCallback& callback) override { |
241 ServiceWorkerContextClient* client = | 242 ServiceWorkerContextClient* client = |
242 ServiceWorkerContextClient::ThreadSpecificInstance(); | 243 ServiceWorkerContextClient::ThreadSpecificInstance(); |
243 if (!client) { | 244 if (!client) { |
244 callback.Run(SERVICE_WORKER_ERROR_ABORT, base::Time::Now()); | 245 callback.Run(SERVICE_WORKER_ERROR_ABORT, base::Time::Now()); |
245 return; | 246 return; |
246 } | 247 } |
| 248 if (preload_handle) { |
| 249 // TODO(horo): Implement this to pass |preload_handle| to FetchEvent. |
| 250 NOTIMPLEMENTED(); |
| 251 return; |
| 252 } |
247 client->DispatchFetchEvent(fetch_event_id, request, callback); | 253 client->DispatchFetchEvent(fetch_event_id, request, callback); |
248 } | 254 } |
249 | 255 |
250 private: | 256 private: |
251 DISALLOW_COPY_AND_ASSIGN(FetchEventDispatcherImpl); | 257 DISALLOW_COPY_AND_ASSIGN(FetchEventDispatcherImpl); |
252 }; | 258 }; |
253 | 259 |
254 ServiceWorkerContextClient* | 260 ServiceWorkerContextClient* |
255 ServiceWorkerContextClient::ThreadSpecificInstance() { | 261 ServiceWorkerContextClient::ThreadSpecificInstance() { |
256 return g_worker_client_tls.Pointer()->Get(); | 262 return g_worker_client_tls.Pointer()->Get(); |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 } | 1142 } |
1137 | 1143 |
1138 base::WeakPtr<ServiceWorkerContextClient> | 1144 base::WeakPtr<ServiceWorkerContextClient> |
1139 ServiceWorkerContextClient::GetWeakPtr() { | 1145 ServiceWorkerContextClient::GetWeakPtr() { |
1140 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1146 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
1141 DCHECK(context_); | 1147 DCHECK(context_); |
1142 return context_->weak_factory.GetWeakPtr(); | 1148 return context_->weak_factory.GetWeakPtr(); |
1143 } | 1149 } |
1144 | 1150 |
1145 } // namespace content | 1151 } // namespace content |
OLD | NEW |