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

Side by Side Diff: content/browser/service_worker/service_worker_context_core.h

Issue 2638313002: Manage ServiceWorkerDispatcherHost in ServiceWorkerContextCore (Closed)
Patch Set: Remove a break line Created 3 years, 10 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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 26 matching lines...) Expand all
37 class QuotaManagerProxy; 37 class QuotaManagerProxy;
38 class SpecialStoragePolicy; 38 class SpecialStoragePolicy;
39 } 39 }
40 40
41 namespace content { 41 namespace content {
42 42
43 class EmbeddedWorkerRegistry; 43 class EmbeddedWorkerRegistry;
44 class ServiceWorkerContextObserver; 44 class ServiceWorkerContextObserver;
45 class ServiceWorkerContextWrapper; 45 class ServiceWorkerContextWrapper;
46 class ServiceWorkerDatabaseTaskManager; 46 class ServiceWorkerDatabaseTaskManager;
47 class ServiceWorkerDispatcherHost;
47 class ServiceWorkerJobCoordinator; 48 class ServiceWorkerJobCoordinator;
48 class ServiceWorkerNavigationHandleCore; 49 class ServiceWorkerNavigationHandleCore;
49 class ServiceWorkerProviderHost; 50 class ServiceWorkerProviderHost;
50 class ServiceWorkerRegistration; 51 class ServiceWorkerRegistration;
51 class ServiceWorkerStorage; 52 class ServiceWorkerStorage;
52 53
53 // This class manages data associated with service workers. 54 // This class manages data associated with service workers.
54 // The class is single threaded and should only be used on the IO thread. 55 // The class is single threaded and should only be used on the IO thread.
55 // In chromium, there is one instance per storagepartition. This class 56 // In chromium, there is one instance per storagepartition. This class
56 // is the root of the containment hierarchy for service worker data 57 // is the root of the containment hierarchy for service worker data
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 ServiceWorkerContextWrapper* wrapper() const { return wrapper_; } 148 ServiceWorkerContextWrapper* wrapper() const { return wrapper_; }
148 ServiceWorkerStorage* storage() { return storage_.get(); } 149 ServiceWorkerStorage* storage() { return storage_.get(); }
149 ServiceWorkerProcessManager* process_manager(); 150 ServiceWorkerProcessManager* process_manager();
150 EmbeddedWorkerRegistry* embedded_worker_registry() { 151 EmbeddedWorkerRegistry* embedded_worker_registry() {
151 return embedded_worker_registry_.get(); 152 return embedded_worker_registry_.get();
152 } 153 }
153 ServiceWorkerJobCoordinator* job_coordinator() { 154 ServiceWorkerJobCoordinator* job_coordinator() {
154 return job_coordinator_.get(); 155 return job_coordinator_.get();
155 } 156 }
156 157
158 // Maintains DispatcherHosts to exchange service worker related messages
159 // through them. The DispatcherHosts are not owned by this class.
160 void AddDispatcherHost(int process_id,
161 ServiceWorkerDispatcherHost* dispatcher_host);
162 ServiceWorkerDispatcherHost* GetDispatcherHost(int process_id);
163 void RemoveDispatcherHost(int process_id);
164
157 // The context class owns the set of ProviderHosts. 165 // The context class owns the set of ProviderHosts.
158 ServiceWorkerProviderHost* GetProviderHost(int process_id, int provider_id);
159 void AddProviderHost( 166 void AddProviderHost(
160 std::unique_ptr<ServiceWorkerProviderHost> provider_host); 167 std::unique_ptr<ServiceWorkerProviderHost> provider_host);
168 void AddProviderHost(int process_id,
horo 2017/02/08 02:14:11 Remove this.
shimazu 2017/02/13 03:25:56 Done.
169 ServiceWorkerProviderHostInfo provider_host_info);
170 ServiceWorkerProviderHost* GetProviderHost(int process_id, int provider_id);
161 void RemoveProviderHost(int process_id, int provider_id); 171 void RemoveProviderHost(int process_id, int provider_id);
162 void RemoveAllProviderHostsForProcess(int process_id); 172 void RemoveAllProviderHostsForProcess(int process_id);
163 std::unique_ptr<ProviderHostIterator> GetProviderHostIterator(); 173 std::unique_ptr<ProviderHostIterator> GetProviderHostIterator();
164 174
165 // Returns a ProviderHost iterator for all ServiceWorker clients for 175 // Returns a ProviderHost iterator for all ServiceWorker clients for
166 // the |origin|. This only returns ProviderHosts that are of CONTROLLEE 176 // the |origin|. This only returns ProviderHosts that are of CONTROLLEE
167 // and belong to the |origin|. 177 // and belong to the |origin|.
168 std::unique_ptr<ProviderHostIterator> GetClientProviderHostIterator( 178 std::unique_ptr<ProviderHostIterator> GetClientProviderHostIterator(
169 const GURL& origin); 179 const GURL& origin);
170 180
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 ServiceWorkerStatusCode status, 345 ServiceWorkerStatusCode status,
336 scoped_refptr<ServiceWorkerRegistration> registration); 346 scoped_refptr<ServiceWorkerRegistration> registration);
337 void OnRegistrationFinishedForCheckHasServiceWorker( 347 void OnRegistrationFinishedForCheckHasServiceWorker(
338 const ServiceWorkerContext::CheckHasServiceWorkerCallback callback, 348 const ServiceWorkerContext::CheckHasServiceWorkerCallback callback,
339 scoped_refptr<ServiceWorkerRegistration> registration); 349 scoped_refptr<ServiceWorkerRegistration> registration);
340 350
341 // It's safe to store a raw pointer instead of a scoped_refptr to |wrapper_| 351 // It's safe to store a raw pointer instead of a scoped_refptr to |wrapper_|
342 // because the Wrapper::Shutdown call that hops threads to destroy |this| uses 352 // because the Wrapper::Shutdown call that hops threads to destroy |this| uses
343 // Bind() to hold a reference to |wrapper_| until |this| is fully destroyed. 353 // Bind() to hold a reference to |wrapper_| until |this| is fully destroyed.
344 ServiceWorkerContextWrapper* wrapper_; 354 ServiceWorkerContextWrapper* wrapper_;
355 std::unique_ptr<IDMap<ServiceWorkerDispatcherHost*>> dispatcher_hosts_;
345 std::unique_ptr<ProcessToProviderMap> providers_; 356 std::unique_ptr<ProcessToProviderMap> providers_;
346 std::unique_ptr<ProviderByClientUUIDMap> provider_by_uuid_; 357 std::unique_ptr<ProviderByClientUUIDMap> provider_by_uuid_;
347 std::unique_ptr<ServiceWorkerStorage> storage_; 358 std::unique_ptr<ServiceWorkerStorage> storage_;
348 scoped_refptr<EmbeddedWorkerRegistry> embedded_worker_registry_; 359 scoped_refptr<EmbeddedWorkerRegistry> embedded_worker_registry_;
349 std::unique_ptr<ServiceWorkerJobCoordinator> job_coordinator_; 360 std::unique_ptr<ServiceWorkerJobCoordinator> job_coordinator_;
350 std::map<int64_t, ServiceWorkerRegistration*> live_registrations_; 361 std::map<int64_t, ServiceWorkerRegistration*> live_registrations_;
351 std::map<int64_t, ServiceWorkerVersion*> live_versions_; 362 std::map<int64_t, ServiceWorkerVersion*> live_versions_;
352 std::map<int64_t, scoped_refptr<ServiceWorkerVersion>> protected_versions_; 363 std::map<int64_t, scoped_refptr<ServiceWorkerVersion>> protected_versions_;
353 364
354 std::map<int64_t /* version_id */, FailureInfo> failure_counts_; 365 std::map<int64_t /* version_id */, FailureInfo> failure_counts_;
(...skipping 13 matching lines...) Expand all
368 scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>> 379 scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>>
369 observer_list_; 380 observer_list_;
370 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_; 381 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_;
371 382
372 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore); 383 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore);
373 }; 384 };
374 385
375 } // namespace content 386 } // namespace content
376 387
377 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ 388 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698