| 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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 // FindRegistrationForId() can run the callback synchronously. | 704 // FindRegistrationForId() can run the callback synchronously. |
| 705 callback.Run(SERVICE_WORKER_ERROR_ABORT, nullptr); | 705 callback.Run(SERVICE_WORKER_ERROR_ABORT, nullptr); |
| 706 return; | 706 return; |
| 707 } | 707 } |
| 708 context_core_->storage()->FindRegistrationForId( | 708 context_core_->storage()->FindRegistrationForId( |
| 709 registration_id, origin.GetOrigin(), | 709 registration_id, origin.GetOrigin(), |
| 710 base::Bind(&ServiceWorkerContextWrapper::DidFindRegistrationForFindReady, | 710 base::Bind(&ServiceWorkerContextWrapper::DidFindRegistrationForFindReady, |
| 711 this, callback)); | 711 this, callback)); |
| 712 } | 712 } |
| 713 | 713 |
| 714 void ServiceWorkerContextWrapper::FindReadyRegistrationForIdOnly( |
| 715 int64_t registration_id, |
| 716 const FindRegistrationCallback& callback) { |
| 717 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 718 if (!context_core_) { |
| 719 // FindRegistrationForIdOnly() can run the callback synchronously. |
| 720 callback.Run(SERVICE_WORKER_ERROR_ABORT, nullptr); |
| 721 return; |
| 722 } |
| 723 context_core_->storage()->FindRegistrationForIdOnly( |
| 724 registration_id, |
| 725 base::Bind(&ServiceWorkerContextWrapper::DidFindRegistrationForFindReady, |
| 726 this, callback)); |
| 727 } |
| 728 |
| 714 void ServiceWorkerContextWrapper::DidFindRegistrationForFindReady( | 729 void ServiceWorkerContextWrapper::DidFindRegistrationForFindReady( |
| 715 const FindRegistrationCallback& callback, | 730 const FindRegistrationCallback& callback, |
| 716 ServiceWorkerStatusCode status, | 731 ServiceWorkerStatusCode status, |
| 717 scoped_refptr<ServiceWorkerRegistration> registration) { | 732 scoped_refptr<ServiceWorkerRegistration> registration) { |
| 718 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 733 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 719 if (status != SERVICE_WORKER_OK) { | 734 if (status != SERVICE_WORKER_OK) { |
| 720 callback.Run(status, nullptr); | 735 callback.Run(status, nullptr); |
| 721 return; | 736 return; |
| 722 } | 737 } |
| 723 | 738 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 observer_list_->Notify(FROM_HERE, | 923 observer_list_->Notify(FROM_HERE, |
| 909 &ServiceWorkerContextObserver::OnStorageWiped); | 924 &ServiceWorkerContextObserver::OnStorageWiped); |
| 910 } | 925 } |
| 911 | 926 |
| 912 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { | 927 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { |
| 913 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 928 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 914 return context_core_.get(); | 929 return context_core_.get(); |
| 915 } | 930 } |
| 916 | 931 |
| 917 } // namespace content | 932 } // namespace content |
| OLD | NEW |