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/basictypes.h" | 8 #include "base/basictypes.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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 virtual void OnReportConsoleMessage(ServiceWorkerVersion* version, | 60 virtual void OnReportConsoleMessage(ServiceWorkerVersion* version, |
61 int source_identifier, | 61 int source_identifier, |
62 int message_level, | 62 int message_level, |
63 const base::string16& message, | 63 const base::string16& message, |
64 int line_number, | 64 int line_number, |
65 const GURL& source_url) OVERRIDE; | 65 const GURL& source_url) OVERRIDE; |
66 virtual void OnVersionStateChanged(ServiceWorkerVersion* version) OVERRIDE; | 66 virtual void OnVersionStateChanged(ServiceWorkerVersion* version) OVERRIDE; |
67 | 67 |
68 ServiceWorkerObjectInfo GetObjectInfo(); | 68 ServiceWorkerObjectInfo GetObjectInfo(); |
69 | 69 |
| 70 int thread_id() const { return thread_id_; } |
| 71 int handle_id() const { return handle_id_; } |
70 ServiceWorkerRegistration* registration() { return registration_.get(); } | 72 ServiceWorkerRegistration* registration() { return registration_.get(); } |
71 ServiceWorkerVersion* version() { return version_.get(); } | 73 ServiceWorkerVersion* version() { return version_.get(); } |
72 int handle_id() const { return handle_id_; } | |
73 | 74 |
74 bool HasNoRefCount() const { return ref_count_ <= 0; } | 75 bool HasNoRefCount() const { return ref_count_ <= 0; } |
75 void IncrementRefCount(); | 76 void IncrementRefCount(); |
76 void DecrementRefCount(); | 77 void DecrementRefCount(); |
77 | 78 |
78 private: | 79 private: |
79 base::WeakPtr<ServiceWorkerContextCore> context_; | 80 base::WeakPtr<ServiceWorkerContextCore> context_; |
80 IPC::Sender* sender_; // Not owned, it should always outlive this. | 81 IPC::Sender* sender_; // Not owned, it should always outlive this. |
81 const int thread_id_; | 82 const int thread_id_; |
82 const int handle_id_; | 83 const int handle_id_; |
83 int ref_count_; // Created with 1. | 84 int ref_count_; // Created with 1. |
84 scoped_refptr<ServiceWorkerRegistration> registration_; | 85 scoped_refptr<ServiceWorkerRegistration> registration_; |
85 scoped_refptr<ServiceWorkerVersion> version_; | 86 scoped_refptr<ServiceWorkerVersion> version_; |
86 | 87 |
87 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandle); | 88 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandle); |
88 }; | 89 }; |
89 | 90 |
90 } // namespace content | 91 } // namespace content |
91 | 92 |
92 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_ | 93 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_ |
OLD | NEW |