| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_ | 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_ |
| 6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_ | 6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 ThreadSafeSender* thread_safe_sender); | 51 ThreadSafeSender* thread_safe_sender); |
| 52 | 52 |
| 53 // Called from ServiceWorkerDispatcher. | 53 // Called from ServiceWorkerDispatcher. |
| 54 void OnAssociateRegistration( | 54 void OnAssociateRegistration( |
| 55 std::unique_ptr<ServiceWorkerRegistrationHandleReference> registration, | 55 std::unique_ptr<ServiceWorkerRegistrationHandleReference> registration, |
| 56 std::unique_ptr<ServiceWorkerHandleReference> installing, | 56 std::unique_ptr<ServiceWorkerHandleReference> installing, |
| 57 std::unique_ptr<ServiceWorkerHandleReference> waiting, | 57 std::unique_ptr<ServiceWorkerHandleReference> waiting, |
| 58 std::unique_ptr<ServiceWorkerHandleReference> active); | 58 std::unique_ptr<ServiceWorkerHandleReference> active); |
| 59 void OnDisassociateRegistration(); | 59 void OnDisassociateRegistration(); |
| 60 void OnSetControllerServiceWorker( | 60 void OnSetControllerServiceWorker( |
| 61 std::unique_ptr<ServiceWorkerHandleReference> controller); | 61 std::unique_ptr<ServiceWorkerHandleReference> controller, |
| 62 const std::set<uint32_t>& used_features); |
| 62 | 63 |
| 63 // Called on the worker thread. Used for initializing | 64 // Called on the worker thread. Used for initializing |
| 64 // ServiceWorkerGlobalScope. | 65 // ServiceWorkerGlobalScope. |
| 65 void GetAssociatedRegistration(ServiceWorkerRegistrationObjectInfo* info, | 66 void GetAssociatedRegistration(ServiceWorkerRegistrationObjectInfo* info, |
| 66 ServiceWorkerVersionAttributes* attrs); | 67 ServiceWorkerVersionAttributes* attrs); |
| 67 | 68 |
| 68 // May be called on the main or worker thread. | 69 // May be called on the main or worker thread. |
| 69 bool HasAssociatedRegistration(); | 70 bool HasAssociatedRegistration(); |
| 70 | 71 |
| 71 int provider_id() const { return provider_id_; } | 72 int provider_id() const { return provider_id_; } |
| 72 | 73 |
| 73 ServiceWorkerHandleReference* controller(); | 74 ServiceWorkerHandleReference* controller(); |
| 75 const std::set<uint32_t>& used_features() const { return used_features_; } |
| 74 | 76 |
| 75 private: | 77 private: |
| 76 friend class base::DeleteHelper<ServiceWorkerProviderContext>; | 78 friend class base::DeleteHelper<ServiceWorkerProviderContext>; |
| 77 friend class base::RefCountedThreadSafe<ServiceWorkerProviderContext, | 79 friend class base::RefCountedThreadSafe<ServiceWorkerProviderContext, |
| 78 ServiceWorkerProviderContextDeleter>; | 80 ServiceWorkerProviderContextDeleter>; |
| 79 friend struct ServiceWorkerProviderContextDeleter; | 81 friend struct ServiceWorkerProviderContextDeleter; |
| 80 | 82 |
| 81 class Delegate; | 83 class Delegate; |
| 82 class ControlleeDelegate; | 84 class ControlleeDelegate; |
| 83 class ControllerDelegate; | 85 class ControllerDelegate; |
| 84 | 86 |
| 85 ~ServiceWorkerProviderContext(); | 87 ~ServiceWorkerProviderContext(); |
| 86 void DestructOnMainThread() const; | 88 void DestructOnMainThread() const; |
| 87 | 89 |
| 88 const int provider_id_; | 90 const int provider_id_; |
| 89 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 91 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 90 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 92 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 91 | 93 |
| 92 std::unique_ptr<Delegate> delegate_; | 94 std::unique_ptr<Delegate> delegate_; |
| 93 | 95 |
| 96 std::set<uint32_t> used_features_; |
| 97 |
| 94 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderContext); | 98 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderContext); |
| 95 }; | 99 }; |
| 96 | 100 |
| 97 struct ServiceWorkerProviderContextDeleter { | 101 struct ServiceWorkerProviderContextDeleter { |
| 98 static void Destruct(const ServiceWorkerProviderContext* context) { | 102 static void Destruct(const ServiceWorkerProviderContext* context) { |
| 99 context->DestructOnMainThread(); | 103 context->DestructOnMainThread(); |
| 100 } | 104 } |
| 101 }; | 105 }; |
| 102 | 106 |
| 103 } // namespace content | 107 } // namespace content |
| 104 | 108 |
| 105 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_ | 109 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_ |
| OLD | NEW |