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 <vector> | 10 #include <vector> |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 const StatusCallback& callback) { | 242 const StatusCallback& callback) { |
243 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 243 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
244 BrowserThread::PostTask( | 244 BrowserThread::PostTask( |
245 BrowserThread::IO, FROM_HERE, | 245 BrowserThread::IO, FROM_HERE, |
246 base::Bind(&ServiceWorkerContextWrapper::StartServiceWorker, this, | 246 base::Bind(&ServiceWorkerContextWrapper::StartServiceWorker, this, |
247 pattern, callback)); | 247 pattern, callback)); |
248 return; | 248 return; |
249 } | 249 } |
250 if (!context_core_.get()) { | 250 if (!context_core_.get()) { |
251 LOG(ERROR) << "ServiceWorkerContextCore is no longer alive."; | 251 LOG(ERROR) << "ServiceWorkerContextCore is no longer alive."; |
252 BrowserThread::PostTask( | 252 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
253 BrowserThread::UI, FROM_HERE, | 253 base::Bind(callback, SERVICE_WORKER_ERROR_ABORT)); |
254 base::Bind(callback, SERVICE_WORKER_ERROR_START_WORKER_FAILED)); | |
255 return; | 254 return; |
256 } | 255 } |
257 context_core_->storage()->FindRegistrationForPattern( | 256 context_core_->storage()->FindRegistrationForPattern( |
258 pattern, base::Bind(&StartActiveWorkerOnIO, callback)); | 257 pattern, base::Bind(&StartActiveWorkerOnIO, callback)); |
259 } | 258 } |
260 | 259 |
261 static void DidFindRegistrationForDocument( | 260 static void DidFindRegistrationForDocument( |
262 const net::CompletionCallback& callback, | 261 const net::CompletionCallback& callback, |
263 ServiceWorkerStatusCode status, | 262 ServiceWorkerStatusCode status, |
264 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 263 const scoped_refptr<ServiceWorkerRegistration>& registration) { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 return; | 448 return; |
450 } | 449 } |
451 context_core_.reset(new ServiceWorkerContextCore(context_core_.get(), this)); | 450 context_core_.reset(new ServiceWorkerContextCore(context_core_.get(), this)); |
452 DVLOG(1) << "Restarted ServiceWorkerContextCore successfully."; | 451 DVLOG(1) << "Restarted ServiceWorkerContextCore successfully."; |
453 | 452 |
454 observer_list_->Notify(FROM_HERE, | 453 observer_list_->Notify(FROM_HERE, |
455 &ServiceWorkerContextObserver::OnStorageWiped); | 454 &ServiceWorkerContextObserver::OnStorageWiped); |
456 } | 455 } |
457 | 456 |
458 } // namespace content | 457 } // namespace content |
OLD | NEW |