| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 int line_number, | 57 int line_number, |
| 58 int column_number, | 58 int column_number, |
| 59 const GURL& source_url) OVERRIDE; | 59 const GURL& source_url) OVERRIDE; |
| 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 virtual void OnMainScriptCached(ServiceWorkerVersion* version, |
| 68 bool success) OVERRIDE {} |
| 69 virtual void OnAllScriptsCached(ServiceWorkerVersion* version, |
| 70 bool success) OVERRIDE {} |
| 71 |
| 67 | 72 |
| 68 ServiceWorkerObjectInfo GetObjectInfo(); | 73 ServiceWorkerObjectInfo GetObjectInfo(); |
| 69 | 74 |
| 70 ServiceWorkerRegistration* registration() { return registration_.get(); } | 75 ServiceWorkerRegistration* registration() { return registration_.get(); } |
| 71 ServiceWorkerVersion* version() { return version_.get(); } | 76 ServiceWorkerVersion* version() { return version_.get(); } |
| 72 int handle_id() const { return handle_id_; } | 77 int handle_id() const { return handle_id_; } |
| 73 | 78 |
| 74 bool HasNoRefCount() const { return ref_count_ <= 0; } | 79 bool HasNoRefCount() const { return ref_count_ <= 0; } |
| 75 void IncrementRefCount(); | 80 void IncrementRefCount(); |
| 76 void DecrementRefCount(); | 81 void DecrementRefCount(); |
| 77 | 82 |
| 78 private: | 83 private: |
| 79 base::WeakPtr<ServiceWorkerContextCore> context_; | 84 base::WeakPtr<ServiceWorkerContextCore> context_; |
| 80 IPC::Sender* sender_; // Not owned, it should always outlive this. | 85 IPC::Sender* sender_; // Not owned, it should always outlive this. |
| 81 const int thread_id_; | 86 const int thread_id_; |
| 82 const int handle_id_; | 87 const int handle_id_; |
| 83 int ref_count_; // Created with 1. | 88 int ref_count_; // Created with 1. |
| 84 scoped_refptr<ServiceWorkerRegistration> registration_; | 89 scoped_refptr<ServiceWorkerRegistration> registration_; |
| 85 scoped_refptr<ServiceWorkerVersion> version_; | 90 scoped_refptr<ServiceWorkerVersion> version_; |
| 86 | 91 |
| 87 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandle); | 92 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandle); |
| 88 }; | 93 }; |
| 89 | 94 |
| 90 } // namespace content | 95 } // namespace content |
| 91 | 96 |
| 92 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_ | 97 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_ |
| OLD | NEW |