| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 BrowserThread::IO, | 185 BrowserThread::IO, |
| 186 FROM_HERE, | 186 FROM_HERE, |
| 187 base::Bind(&ServiceWorkerContextWrapper::RegisterServiceWorker, | 187 base::Bind(&ServiceWorkerContextWrapper::RegisterServiceWorker, |
| 188 this, | 188 this, |
| 189 pattern, | 189 pattern, |
| 190 script_url, | 190 script_url, |
| 191 continuation)); | 191 continuation)); |
| 192 return; | 192 return; |
| 193 } | 193 } |
| 194 if (!context_core_) { | 194 if (!context_core_) { |
| 195 BrowserThread::PostTask( | 195 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 196 BrowserThread::IO, | 196 base::Bind(continuation, false)); |
| 197 FROM_HERE, | |
| 198 base::Bind(continuation, false)); | |
| 199 return; | 197 return; |
| 200 } | 198 } |
| 201 context()->RegisterServiceWorker( | 199 context()->RegisterServiceWorker( |
| 202 net::SimplifyUrlForRequest(pattern), | 200 net::SimplifyUrlForRequest(pattern), |
| 203 net::SimplifyUrlForRequest(script_url), NULL /* provider_host */, | 201 net::SimplifyUrlForRequest(script_url), NULL /* provider_host */, |
| 204 base::Bind(&FinishRegistrationOnIO, continuation)); | 202 base::Bind(&FinishRegistrationOnIO, continuation)); |
| 205 } | 203 } |
| 206 | 204 |
| 207 static void FinishUnregistrationOnIO( | 205 static void FinishUnregistrationOnIO( |
| 208 const ServiceWorkerContext::ResultCallback& continuation, | 206 const ServiceWorkerContext::ResultCallback& continuation, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 221 BrowserThread::PostTask( | 219 BrowserThread::PostTask( |
| 222 BrowserThread::IO, | 220 BrowserThread::IO, |
| 223 FROM_HERE, | 221 FROM_HERE, |
| 224 base::Bind(&ServiceWorkerContextWrapper::UnregisterServiceWorker, | 222 base::Bind(&ServiceWorkerContextWrapper::UnregisterServiceWorker, |
| 225 this, | 223 this, |
| 226 pattern, | 224 pattern, |
| 227 continuation)); | 225 continuation)); |
| 228 return; | 226 return; |
| 229 } | 227 } |
| 230 if (!context_core_) { | 228 if (!context_core_) { |
| 231 BrowserThread::PostTask( | 229 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 232 BrowserThread::IO, | 230 base::Bind(continuation, false)); |
| 233 FROM_HERE, | |
| 234 base::Bind(continuation, false)); | |
| 235 return; | 231 return; |
| 236 } | 232 } |
| 237 | 233 |
| 238 context()->UnregisterServiceWorker( | 234 context()->UnregisterServiceWorker( |
| 239 net::SimplifyUrlForRequest(pattern), | 235 net::SimplifyUrlForRequest(pattern), |
| 240 base::Bind(&FinishUnregistrationOnIO, continuation)); | 236 base::Bind(&FinishUnregistrationOnIO, continuation)); |
| 241 } | 237 } |
| 242 | 238 |
| 243 void ServiceWorkerContextWrapper::UpdateRegistration(const GURL& pattern) { | 239 void ServiceWorkerContextWrapper::UpdateRegistration(const GURL& pattern) { |
| 244 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 240 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 observer_list_->Notify(FROM_HERE, | 698 observer_list_->Notify(FROM_HERE, |
| 703 &ServiceWorkerContextObserver::OnStorageWiped); | 699 &ServiceWorkerContextObserver::OnStorageWiped); |
| 704 } | 700 } |
| 705 | 701 |
| 706 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { | 702 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { |
| 707 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 703 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 708 return context_core_.get(); | 704 return context_core_.get(); |
| 709 } | 705 } |
| 710 | 706 |
| 711 } // namespace content | 707 } // namespace content |
| OLD | NEW |