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_context_wrapper.h" | 5 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 259 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
260 BrowserThread::PostTask( | 260 BrowserThread::PostTask( |
261 BrowserThread::UI, | 261 BrowserThread::UI, |
262 FROM_HERE, | 262 FROM_HERE, |
263 base::Bind(continuation, status == SERVICE_WORKER_OK)); | 263 base::Bind(continuation, status == SERVICE_WORKER_OK)); |
264 } | 264 } |
265 | 265 |
266 void ServiceWorkerContextWrapper::RegisterServiceWorker( | 266 void ServiceWorkerContextWrapper::RegisterServiceWorker( |
267 const GURL& pattern, | 267 const GURL& pattern, |
268 const GURL& script_url, | 268 const GURL& script_url, |
| 269 blink::WebServiceWorkerUpdateViaCache update_via_cache, |
269 const ResultCallback& continuation) { | 270 const ResultCallback& continuation) { |
270 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 271 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
271 BrowserThread::PostTask( | 272 BrowserThread::PostTask( |
272 BrowserThread::IO, | 273 BrowserThread::IO, FROM_HERE, |
273 FROM_HERE, | 274 base::Bind(&ServiceWorkerContextWrapper::RegisterServiceWorker, this, |
274 base::Bind(&ServiceWorkerContextWrapper::RegisterServiceWorker, | 275 pattern, script_url, update_via_cache, continuation)); |
275 this, | |
276 pattern, | |
277 script_url, | |
278 continuation)); | |
279 return; | 276 return; |
280 } | 277 } |
281 if (!context_core_) { | 278 if (!context_core_) { |
282 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 279 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
283 base::Bind(continuation, false)); | 280 base::Bind(continuation, false)); |
284 return; | 281 return; |
285 } | 282 } |
286 ServiceWorkerRegistrationOptions options(net::SimplifyUrlForRequest(pattern)); | 283 ServiceWorkerRegistrationOptions options(net::SimplifyUrlForRequest(pattern), |
| 284 update_via_cache); |
287 context()->RegisterServiceWorker( | 285 context()->RegisterServiceWorker( |
288 net::SimplifyUrlForRequest(script_url), options, | 286 net::SimplifyUrlForRequest(script_url), options, |
289 nullptr /* provider_host */, | 287 nullptr /* provider_host */, |
290 base::Bind(&FinishRegistrationOnIO, continuation)); | 288 base::Bind(&FinishRegistrationOnIO, continuation)); |
291 } | 289 } |
292 | 290 |
293 static void FinishUnregistrationOnIO( | 291 static void FinishUnregistrationOnIO( |
294 const ServiceWorkerContext::ResultCallback& continuation, | 292 const ServiceWorkerContext::ResultCallback& continuation, |
295 ServiceWorkerStatusCode status) { | 293 ServiceWorkerStatusCode status) { |
296 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 294 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 service_worker_provider_id, | 1038 service_worker_provider_id, |
1041 std::move(client_ptr_info)); | 1039 std::move(client_ptr_info)); |
1042 } | 1040 } |
1043 | 1041 |
1044 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { | 1042 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { |
1045 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1043 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1046 return context_core_.get(); | 1044 return context_core_.get(); |
1047 } | 1045 } |
1048 | 1046 |
1049 } // namespace content | 1047 } // namespace content |
OLD | NEW |