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_PROVIDER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "content/common/content_export.h" |
9 | 10 |
10 namespace content { | 11 namespace content { |
11 | 12 |
12 class ServiceWorkerVersion; | 13 class ServiceWorkerVersion; |
13 | 14 |
14 // This class is the browser-process representation of a serice worker | 15 // This class is the browser-process representation of a serice worker |
15 // provider. There is a provider per document and the lifetime of this | 16 // provider. There is a provider per document and the lifetime of this |
16 // object is tied to the lifetime of its document in the renderer process. | 17 // object is tied to the lifetime of its document in the renderer process. |
17 // This class holds service worker state this is scoped to an individual | 18 // This class holds service worker state this is scoped to an individual |
18 // document. | 19 // document. |
19 class ServiceWorkerProviderHost { | 20 class CONTENT_EXPORT ServiceWorkerProviderHost { |
20 public: | 21 public: |
21 ServiceWorkerProviderHost(int process_id, | 22 ServiceWorkerProviderHost(int process_id, |
22 int provider_id); | 23 int provider_id); |
23 ~ServiceWorkerProviderHost(); | 24 ~ServiceWorkerProviderHost(); |
24 | 25 |
25 int process_id() const { return process_id_; } | 26 int process_id() const { return process_id_; } |
26 int provider_id() const { return provider_id_; } | 27 int provider_id() const { return provider_id_; } |
27 | 28 |
28 // The service worker version that corresponds with navigator.serviceWorker | 29 // The service worker version that corresponds with navigator.serviceWorker |
29 // for our document. | 30 // for our document. |
30 ServiceWorkerVersion* associated_version() const { | 31 ServiceWorkerVersion* associated_version() const { |
31 return associated_version_.get(); | 32 return associated_version_.get(); |
32 } | 33 } |
33 | 34 |
34 private: | 35 private: |
35 const int process_id_; | 36 const int process_id_; |
36 const int provider_id_; | 37 const int provider_id_; |
37 scoped_refptr<ServiceWorkerVersion> associated_version_; | 38 scoped_refptr<ServiceWorkerVersion> associated_version_; |
38 }; | 39 }; |
39 | 40 |
40 } // namespace content | 41 } // namespace content |
41 | 42 |
42 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 43 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
OLD | NEW |