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_REGISTRATION_HANDLE_REFERENC
E_H_ | 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_REFERENC
E_H_ |
6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_REFERENC
E_H_ | 6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_REFERENC
E_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/common/service_worker/service_worker_types.h" |
10 #include "url/gurl.h" | 11 #include "url/gurl.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 class ThreadSafeSender; | 15 class ThreadSafeSender; |
15 struct ServiceWorkerObjectInfo; | |
16 | 16 |
17 class ServiceWorkerRegistrationHandleReference { | 17 class ServiceWorkerRegistrationHandleReference { |
18 public: | 18 public: |
19 // Creates a new ServiceWorkerRegistrationHandleReference and increments | 19 // Creates a new ServiceWorkerRegistrationHandleReference and increments |
20 // ref-count. | 20 // ref-count. |
21 static scoped_ptr<ServiceWorkerRegistrationHandleReference> Create( | 21 static scoped_ptr<ServiceWorkerRegistrationHandleReference> Create( |
22 int registration_handle_id, | 22 const ServiceWorkerRegistrationObjectInfo& info, |
23 const ServiceWorkerObjectInfo& info, | |
24 ThreadSafeSender* sender); | 23 ThreadSafeSender* sender); |
25 | 24 |
26 // Creates a new ServiceWorkerRegistrationHandleReference by adopting a | 25 // Creates a new ServiceWorkerRegistrationHandleReference by adopting a |
27 // ref-count. | 26 // ref-count. |
28 static scoped_ptr<ServiceWorkerRegistrationHandleReference> Adopt( | 27 static scoped_ptr<ServiceWorkerRegistrationHandleReference> Adopt( |
29 int registration_handle_id, | 28 const ServiceWorkerRegistrationObjectInfo& info, |
30 const ServiceWorkerObjectInfo& info, | |
31 ThreadSafeSender* sender); | 29 ThreadSafeSender* sender); |
32 | 30 |
33 ~ServiceWorkerRegistrationHandleReference(); | 31 ~ServiceWorkerRegistrationHandleReference(); |
34 | 32 |
35 int handle_id() const { return handle_id_; } | 33 int handle_id() const { return info_.handle_id; } |
36 GURL scope() const { return scope_; } | 34 GURL scope() const { return info_.scope; } |
37 | 35 |
38 private: | 36 private: |
39 ServiceWorkerRegistrationHandleReference(int registration_handle_id, | 37 ServiceWorkerRegistrationHandleReference( |
40 const ServiceWorkerObjectInfo& info, | 38 const ServiceWorkerRegistrationObjectInfo& info, |
41 ThreadSafeSender* sender, | 39 ThreadSafeSender* sender, |
42 bool increment_ref_in_ctor); | 40 bool increment_ref_in_ctor); |
43 | 41 |
44 const int handle_id_; | 42 ServiceWorkerRegistrationObjectInfo info_; |
45 const GURL scope_; | |
46 scoped_refptr<ThreadSafeSender> sender_; | 43 scoped_refptr<ThreadSafeSender> sender_; |
47 | 44 |
48 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistrationHandleReference); | 45 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistrationHandleReference); |
49 }; | 46 }; |
50 | 47 |
51 } // namespace content | 48 } // namespace content |
52 | 49 |
53 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_REFER
ENCE_H_ | 50 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_REFER
ENCE_H_ |
OLD | NEW |