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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 void StartActiveWorkerOnIO( | 55 void StartActiveWorkerOnIO( |
56 const ServiceWorkerContextWrapper::StatusCallback& callback, | 56 const ServiceWorkerContextWrapper::StatusCallback& callback, |
57 ServiceWorkerStatusCode status, | 57 ServiceWorkerStatusCode status, |
58 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 58 const scoped_refptr<ServiceWorkerRegistration>& registration) { |
59 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 59 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
60 if (status == SERVICE_WORKER_OK) { | 60 if (status == SERVICE_WORKER_OK) { |
61 // Pass the reference of |registration| to WorkerStarted callback to prevent | 61 // Pass the reference of |registration| to WorkerStarted callback to prevent |
62 // it from being deleted while starting the worker. If the refcount of | 62 // it from being deleted while starting the worker. If the refcount of |
63 // |registration| is 1, it will be deleted after WorkerStarted is called. | 63 // |registration| is 1, it will be deleted after WorkerStarted is called. |
64 registration->active_version()->StartWorker( | 64 registration->active_version()->StartWorker( |
| 65 ServiceWorkerMetrics::EventType::UNKNOWN, |
65 base::Bind(WorkerStarted, callback)); | 66 base::Bind(WorkerStarted, callback)); |
66 return; | 67 return; |
67 } | 68 } |
68 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 69 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
69 base::Bind(callback, SERVICE_WORKER_ERROR_NOT_FOUND)); | 70 base::Bind(callback, SERVICE_WORKER_ERROR_NOT_FOUND)); |
70 } | 71 } |
71 | 72 |
72 } // namespace | 73 } // namespace |
73 | 74 |
74 void ServiceWorkerContext::AddExcludedHeadersForFetchEvent( | 75 void ServiceWorkerContext::AddExcludedHeadersForFetchEvent( |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 observer_list_->Notify(FROM_HERE, | 721 observer_list_->Notify(FROM_HERE, |
721 &ServiceWorkerContextObserver::OnStorageWiped); | 722 &ServiceWorkerContextObserver::OnStorageWiped); |
722 } | 723 } |
723 | 724 |
724 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { | 725 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { |
725 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 726 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
726 return context_core_.get(); | 727 return context_core_.get(); |
727 } | 728 } |
728 | 729 |
729 } // namespace content | 730 } // namespace content |
OLD | NEW |