Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: content/browser/service_worker/service_worker_context_wrapper.cc

Issue 2931033003: Rename ServiceWorkerContextObserver to ServiceWorkerContextCoreObserver. (Closed)
Patch Set: Typo Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/barrier_closure.h" 13 #include "base/barrier_closure.h"
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
17 #include "base/location.h" 17 #include "base/location.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/profiler/scoped_tracker.h" 19 #include "base/profiler/scoped_tracker.h"
20 #include "base/single_thread_task_runner.h" 20 #include "base/single_thread_task_runner.h"
21 #include "base/threading/sequenced_worker_pool.h" 21 #include "base/threading/sequenced_worker_pool.h"
22 #include "base/threading/thread_task_runner_handle.h" 22 #include "base/threading/thread_task_runner_handle.h"
23 #include "content/browser/service_worker/embedded_worker_status.h" 23 #include "content/browser/service_worker/embedded_worker_status.h"
24 #include "content/browser/service_worker/service_worker_context_core.h" 24 #include "content/browser/service_worker/service_worker_context_core.h"
25 #include "content/browser/service_worker/service_worker_context_observer.h" 25 #include "content/browser/service_worker/service_worker_context_core_observer.h"
26 #include "content/browser/service_worker/service_worker_process_manager.h" 26 #include "content/browser/service_worker/service_worker_process_manager.h"
27 #include "content/browser/service_worker/service_worker_quota_client.h" 27 #include "content/browser/service_worker/service_worker_quota_client.h"
28 #include "content/browser/service_worker/service_worker_version.h" 28 #include "content/browser/service_worker/service_worker_version.h"
29 #include "content/browser/storage_partition_impl.h" 29 #include "content/browser/storage_partition_impl.h"
30 #include "content/common/service_worker/service_worker_utils.h" 30 #include "content/common/service_worker/service_worker_utils.h"
31 #include "content/public/browser/browser_context.h" 31 #include "content/public/browser/browser_context.h"
32 #include "content/public/browser/browser_thread.h" 32 #include "content/public/browser/browser_thread.h"
33 #include "net/base/url_util.h" 33 #include "net/base/url_util.h"
34 #include "storage/browser/quota/quota_manager_proxy.h" 34 #include "storage/browser/quota/quota_manager_proxy.h"
35 #include "storage/browser/quota/special_storage_policy.h" 35 #include "storage/browser/quota/special_storage_policy.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 bool ServiceWorkerContext::IsExcludedHeaderNameForFetchEvent( 98 bool ServiceWorkerContext::IsExcludedHeaderNameForFetchEvent(
99 const std::string& header_name) { 99 const std::string& header_name) {
100 DCHECK_CURRENTLY_ON(BrowserThread::IO); 100 DCHECK_CURRENTLY_ON(BrowserThread::IO);
101 return g_excluded_header_name_set.Get().find(header_name) != 101 return g_excluded_header_name_set.Get().find(header_name) !=
102 g_excluded_header_name_set.Get().end(); 102 g_excluded_header_name_set.Get().end();
103 } 103 }
104 104
105 ServiceWorkerContextWrapper::ServiceWorkerContextWrapper( 105 ServiceWorkerContextWrapper::ServiceWorkerContextWrapper(
106 BrowserContext* browser_context) 106 BrowserContext* browser_context)
107 : observer_list_( 107 : observer_list_(
108 new base::ObserverListThreadSafe<ServiceWorkerContextObserver>()), 108 new base::ObserverListThreadSafe<ServiceWorkerContextCoreObserver>()),
109 process_manager_(new ServiceWorkerProcessManager(browser_context)), 109 process_manager_(new ServiceWorkerProcessManager(browser_context)),
110 is_incognito_(false), 110 is_incognito_(false),
111 storage_partition_(nullptr), 111 storage_partition_(nullptr),
112 resource_context_(nullptr) { 112 resource_context_(nullptr) {
113 DCHECK_CURRENTLY_ON(BrowserThread::UI); 113 DCHECK_CURRENTLY_ON(BrowserThread::UI);
114 } 114 }
115 115
116 ServiceWorkerContextWrapper::~ServiceWorkerContextWrapper() { 116 ServiceWorkerContextWrapper::~ServiceWorkerContextWrapper() {
117 DCHECK(!resource_context_); 117 DCHECK(!resource_context_);
118 } 118 }
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 if (!context_core_) { 732 if (!context_core_) {
733 RunSoon(base::Bind(callback, std::vector<std::pair<int64_t, std::string>>(), 733 RunSoon(base::Bind(callback, std::vector<std::pair<int64_t, std::string>>(),
734 SERVICE_WORKER_ERROR_ABORT)); 734 SERVICE_WORKER_ERROR_ABORT));
735 return; 735 return;
736 } 736 }
737 context_core_->storage()->GetUserDataForAllRegistrationsByKeyPrefix( 737 context_core_->storage()->GetUserDataForAllRegistrationsByKeyPrefix(
738 key_prefix, callback); 738 key_prefix, callback);
739 } 739 }
740 740
741 void ServiceWorkerContextWrapper::AddObserver( 741 void ServiceWorkerContextWrapper::AddObserver(
742 ServiceWorkerContextObserver* observer) { 742 ServiceWorkerContextCoreObserver* observer) {
743 observer_list_->AddObserver(observer); 743 observer_list_->AddObserver(observer);
744 } 744 }
745 745
746 void ServiceWorkerContextWrapper::RemoveObserver( 746 void ServiceWorkerContextWrapper::RemoveObserver(
747 ServiceWorkerContextObserver* observer) { 747 ServiceWorkerContextCoreObserver* observer) {
748 observer_list_->RemoveObserver(observer); 748 observer_list_->RemoveObserver(observer);
749 } 749 }
750 750
751 bool ServiceWorkerContextWrapper::OriginHasForeignFetchRegistrations( 751 bool ServiceWorkerContextWrapper::OriginHasForeignFetchRegistrations(
752 const GURL& origin) { 752 const GURL& origin) {
753 DCHECK_CURRENTLY_ON(BrowserThread::IO); 753 DCHECK_CURRENTLY_ON(BrowserThread::IO);
754 if (!context_core_) 754 if (!context_core_)
755 return false; 755 return false;
756 return context_core_->storage()->OriginHasForeignFetchRegistrations(origin); 756 return context_core_->storage()->OriginHasForeignFetchRegistrations(origin);
757 } 757 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 ServiceWorkerStatusCode status) { 816 ServiceWorkerStatusCode status) {
817 DCHECK_CURRENTLY_ON(BrowserThread::IO); 817 DCHECK_CURRENTLY_ON(BrowserThread::IO);
818 if (status != SERVICE_WORKER_OK) { 818 if (status != SERVICE_WORKER_OK) {
819 context_core_.reset(); 819 context_core_.reset();
820 return; 820 return;
821 } 821 }
822 context_core_.reset(new ServiceWorkerContextCore(context_core_.get(), this)); 822 context_core_.reset(new ServiceWorkerContextCore(context_core_.get(), this));
823 DVLOG(1) << "Restarted ServiceWorkerContextCore successfully."; 823 DVLOG(1) << "Restarted ServiceWorkerContextCore successfully.";
824 824
825 observer_list_->Notify(FROM_HERE, 825 observer_list_->Notify(FROM_HERE,
826 &ServiceWorkerContextObserver::OnStorageWiped); 826 &ServiceWorkerContextCoreObserver::OnStorageWiped);
827 } 827 }
828 828
829 void ServiceWorkerContextWrapper::BindWorkerFetchContext( 829 void ServiceWorkerContextWrapper::BindWorkerFetchContext(
830 int render_process_id, 830 int render_process_id,
831 int service_worker_provider_id, 831 int service_worker_provider_id,
832 mojom::ServiceWorkerWorkerClientAssociatedPtrInfo client_ptr_info) { 832 mojom::ServiceWorkerWorkerClientAssociatedPtrInfo client_ptr_info) {
833 DCHECK_CURRENTLY_ON(BrowserThread::IO); 833 DCHECK_CURRENTLY_ON(BrowserThread::IO);
834 context()->BindWorkerFetchContext(render_process_id, 834 context()->BindWorkerFetchContext(render_process_id,
835 service_worker_provider_id, 835 service_worker_provider_id,
836 std::move(client_ptr_info)); 836 std::move(client_ptr_info));
837 } 837 }
838 838
839 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { 839 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() {
840 DCHECK_CURRENTLY_ON(BrowserThread::IO); 840 DCHECK_CURRENTLY_ON(BrowserThread::IO);
841 return context_core_.get(); 841 return context_core_.get();
842 } 842 }
843 843
844 } // namespace content 844 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698