| 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_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 // ServiceWorkerVersion::Listener overrides. | 48 // ServiceWorkerVersion::Listener overrides. |
| 49 void OnVersionStateChanged(ServiceWorkerVersion* version) override; | 49 void OnVersionStateChanged(ServiceWorkerVersion* version) override; |
| 50 | 50 |
| 51 ServiceWorkerObjectInfo GetObjectInfo(); | 51 ServiceWorkerObjectInfo GetObjectInfo(); |
| 52 | 52 |
| 53 int provider_id() const { return provider_id_; } | 53 int provider_id() const { return provider_id_; } |
| 54 int handle_id() const { return handle_id_; } | 54 int handle_id() const { return handle_id_; } |
| 55 ServiceWorkerVersion* version() { return version_.get(); } | 55 ServiceWorkerVersion* version() { return version_.get(); } |
| 56 | 56 |
| 57 int ref_count() const { return ref_count_; } |
| 57 bool HasNoRefCount() const { return ref_count_ <= 0; } | 58 bool HasNoRefCount() const { return ref_count_ <= 0; } |
| 58 void IncrementRefCount(); | 59 void IncrementRefCount(); |
| 59 void DecrementRefCount(); | 60 void DecrementRefCount(); |
| 60 | 61 |
| 61 private: | 62 private: |
| 62 base::WeakPtr<ServiceWorkerContextCore> context_; | 63 base::WeakPtr<ServiceWorkerContextCore> context_; |
| 63 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; | 64 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; |
| 64 const int provider_id_; | 65 const int provider_id_; |
| 65 const int handle_id_; | 66 const int handle_id_; |
| 66 int ref_count_; // Created with 1. | 67 int ref_count_; // Created with 1. |
| 67 scoped_refptr<ServiceWorkerVersion> version_; | 68 scoped_refptr<ServiceWorkerVersion> version_; |
| 68 | 69 |
| 69 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandle); | 70 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandle); |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 } // namespace content | 73 } // namespace content |
| 73 | 74 |
| 74 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_ | 75 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_ |
| OLD | NEW |