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 <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 // this needs to be RefCountedThreadSafe and .controller info needs to be | 33 // this needs to be RefCountedThreadSafe and .controller info needs to be |
34 // handled in a thread-safe manner (e.g. by a lock etc). | 34 // handled in a thread-safe manner (e.g. by a lock etc). |
35 class ServiceWorkerProviderContext | 35 class ServiceWorkerProviderContext |
36 : public base::RefCounted<ServiceWorkerProviderContext> { | 36 : public base::RefCounted<ServiceWorkerProviderContext> { |
37 public: | 37 public: |
38 explicit ServiceWorkerProviderContext(int provider_id); | 38 explicit ServiceWorkerProviderContext(int provider_id); |
39 | 39 |
40 // Called from ServiceWorkerDispatcher. | 40 // Called from ServiceWorkerDispatcher. |
41 void OnServiceWorkerStateChanged(int handle_id, | 41 void OnServiceWorkerStateChanged(int handle_id, |
42 blink::WebServiceWorkerState state); | 42 blink::WebServiceWorkerState state); |
| 43 void OnSetInstallingServiceWorker(int provider_id, |
| 44 const ServiceWorkerObjectInfo& info); |
43 void OnSetWaitingServiceWorker(int provider_id, | 45 void OnSetWaitingServiceWorker(int provider_id, |
44 const ServiceWorkerObjectInfo& info); | 46 const ServiceWorkerObjectInfo& info); |
45 void OnSetControllerServiceWorker(int provider_id, | 47 void OnSetControllerServiceWorker(int provider_id, |
46 const ServiceWorkerObjectInfo& info); | 48 const ServiceWorkerObjectInfo& info); |
47 | 49 |
48 int provider_id() const { return provider_id_; } | 50 int provider_id() const { return provider_id_; } |
49 | 51 |
| 52 ServiceWorkerHandleReference* installing(); |
50 ServiceWorkerHandleReference* waiting(); | 53 ServiceWorkerHandleReference* waiting(); |
51 ServiceWorkerHandleReference* controller(); | 54 ServiceWorkerHandleReference* controller(); |
52 | 55 |
| 56 // Gets the handle ID of the installing Service Worker, or |
| 57 // kInvalidServiceWorkerHandleId if the provider does not have a |
| 58 // installing Service Worker. |
| 59 int installing_handle_id() const; |
| 60 |
53 // Gets the handle ID of the waiting Service Worker, or | 61 // Gets the handle ID of the waiting Service Worker, or |
54 // kInvalidServiceWorkerHandleId if the provider does not have a | 62 // kInvalidServiceWorkerHandleId if the provider does not have a |
55 // waiting Service Worker. | 63 // waiting Service Worker. |
56 int waiting_handle_id() const; | 64 int waiting_handle_id() const; |
57 | 65 |
58 // Gets the handle ID of the controller, or | 66 // Gets the handle ID of the controller, or |
59 // kInvalidServiceWorkerHandleId if the provider is not controlled | 67 // kInvalidServiceWorkerHandleId if the provider is not controlled |
60 // by a Service Worker. | 68 // by a Service Worker. |
61 int controller_handle_id() const; | 69 int controller_handle_id() const; |
62 | 70 |
63 private: | 71 private: |
64 friend class base::RefCounted<ServiceWorkerProviderContext>; | 72 friend class base::RefCounted<ServiceWorkerProviderContext>; |
65 ~ServiceWorkerProviderContext(); | 73 ~ServiceWorkerProviderContext(); |
66 | 74 |
67 const int provider_id_; | 75 const int provider_id_; |
68 scoped_refptr<base::MessageLoopProxy> main_thread_loop_proxy_; | 76 scoped_refptr<base::MessageLoopProxy> main_thread_loop_proxy_; |
69 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 77 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 78 scoped_ptr<ServiceWorkerHandleReference> installing_; |
70 scoped_ptr<ServiceWorkerHandleReference> waiting_; | 79 scoped_ptr<ServiceWorkerHandleReference> waiting_; |
71 scoped_ptr<ServiceWorkerHandleReference> controller_; | 80 scoped_ptr<ServiceWorkerHandleReference> controller_; |
72 | 81 |
73 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderContext); | 82 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderContext); |
74 }; | 83 }; |
75 | 84 |
76 } // namespace content | 85 } // namespace content |
77 | 86 |
78 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_ | 87 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_ |
OLD | NEW |