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 #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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 // This class manages data associated with service workers. | 53 // This class manages data associated with service workers. |
54 // The class is single threaded and should only be used on the IO thread. | 54 // 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 | 55 // In chromium, there is one instance per storagepartition. This class |
56 // is the root of the containment hierarchy for service worker data | 56 // is the root of the containment hierarchy for service worker data |
57 // associated with a particular partition. | 57 // associated with a particular partition. |
58 class CONTENT_EXPORT ServiceWorkerContextCore | 58 class CONTENT_EXPORT ServiceWorkerContextCore |
59 : NON_EXPORTED_BASE(public ServiceWorkerVersion::Listener) { | 59 : NON_EXPORTED_BASE(public ServiceWorkerVersion::Listener) { |
60 public: | 60 public: |
61 using BoolCallback = base::Callback<void(bool)>; | 61 using BoolCallback = base::Callback<void(bool)>; |
62 typedef base::Callback<void(ServiceWorkerStatusCode status)> StatusCallback; | 62 using StatusCallback = base::Callback<void(ServiceWorkerStatusCode status)>; |
63 typedef base::Callback<void(ServiceWorkerStatusCode status, | 63 using RegistrationCallback = |
64 const std::string& status_message, | 64 base::Callback<void(ServiceWorkerStatusCode status, |
65 int64_t registration_id)> RegistrationCallback; | 65 const std::string& status_message, |
66 typedef base::Callback<void(ServiceWorkerStatusCode status, | 66 int64_t registration_id)>; |
67 const std::string& status_message, | 67 using UpdateCallback = base::Callback<void(ServiceWorkerStatusCode status, |
68 int64_t registration_id)> UpdateCallback; | 68 const std::string& status_message, |
69 typedef base::Callback< | 69 int64_t registration_id)>; |
70 void(ServiceWorkerStatusCode status)> UnregistrationCallback; | 70 using UnregistrationCallback = |
71 typedef IDMap<ServiceWorkerProviderHost, IDMapOwnPointer> ProviderMap; | 71 base::Callback<void(ServiceWorkerStatusCode status)>; |
72 typedef IDMap<ProviderMap, IDMapOwnPointer> ProcessToProviderMap; | 72 using ProviderMap = IDMap<std::unique_ptr<ServiceWorkerProviderHost>>; |
| 73 using ProcessToProviderMap = IDMap<std::unique_ptr<ProviderMap>>; |
73 | 74 |
74 using ProviderByClientUUIDMap = | 75 using ProviderByClientUUIDMap = |
75 std::map<std::string, ServiceWorkerProviderHost*>; | 76 std::map<std::string, ServiceWorkerProviderHost*>; |
76 | 77 |
77 // Directory for ServiceWorkerStorage and ServiceWorkerCacheManager. | 78 // Directory for ServiceWorkerStorage and ServiceWorkerCacheManager. |
78 static const base::FilePath::CharType kServiceWorkerDirectory[]; | 79 static const base::FilePath::CharType kServiceWorkerDirectory[]; |
79 | 80 |
80 // Iterates over ServiceWorkerProviderHost objects in a ProcessToProviderMap. | 81 // Iterates over ServiceWorkerProviderHost objects in a ProcessToProviderMap. |
81 class CONTENT_EXPORT ProviderHostIterator { | 82 class CONTENT_EXPORT ProviderHostIterator { |
82 public: | 83 public: |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>> | 368 scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>> |
368 observer_list_; | 369 observer_list_; |
369 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_; | 370 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_; |
370 | 371 |
371 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore); | 372 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore); |
372 }; | 373 }; |
373 | 374 |
374 } // namespace content | 375 } // namespace content |
375 | 376 |
376 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ | 377 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ |
OLD | NEW |