| 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 class ServiceWorkerContextCore; | 22 class ServiceWorkerContextCore; |
| 23 class ServiceWorkerRegistration; | 23 class ServiceWorkerRegistration; |
| 24 | 24 |
| 25 // Roughly corresponds to one ServiceWorker object in the renderer process | 25 // Roughly corresponds to one ServiceWorker object in the renderer process |
| 26 // (WebServiceWorkerImpl). | 26 // (WebServiceWorkerImpl). |
| 27 // Has references to the corresponding ServiceWorkerVersion and | 27 // Has references to the corresponding ServiceWorkerVersion and |
| 28 // ServiceWorkerRegistration (therefore they're guaranteed to be alive while | 28 // ServiceWorkerRegistration (therefore they're guaranteed to be alive while |
| 29 // this handle is around). | 29 // this handle is around). |
| 30 class CONTENT_EXPORT ServiceWorkerHandle | 30 class CONTENT_EXPORT ServiceWorkerHandle |
| 31 : public ServiceWorkerVersion::Listener { | 31 : NON_EXPORTED_BASE(public ServiceWorkerVersion::Listener) { |
| 32 public: | 32 public: |
| 33 // Creates a handle for a live version. The version's corresponding | 33 // Creates a handle for a live version. The version's corresponding |
| 34 // registration must be also alive. | 34 // registration must be also alive. |
| 35 // This may return NULL if |context|.get() or |version| is NULL. | 35 // This may return NULL if |context|.get() or |version| is NULL. |
| 36 // |sender| and |thread_id| will be used to send messages to the | 36 // |sender| and |thread_id| will be used to send messages to the |
| 37 // corresponding WebServiceWorkerImpl (which should live on |thread_id| | 37 // corresponding WebServiceWorkerImpl (which should live on |thread_id| |
| 38 // in the child process). | 38 // in the child process). |
| 39 static scoped_ptr<ServiceWorkerHandle> Create( | 39 static scoped_ptr<ServiceWorkerHandle> Create( |
| 40 base::WeakPtr<ServiceWorkerContextCore> context, | 40 base::WeakPtr<ServiceWorkerContextCore> context, |
| 41 IPC::Sender* sender, | 41 IPC::Sender* sender, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 int ref_count_; // Created with 1. | 83 int ref_count_; // Created with 1. |
| 84 scoped_refptr<ServiceWorkerRegistration> registration_; | 84 scoped_refptr<ServiceWorkerRegistration> registration_; |
| 85 scoped_refptr<ServiceWorkerVersion> version_; | 85 scoped_refptr<ServiceWorkerVersion> version_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandle); | 87 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandle); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace content | 90 } // namespace content |
| 91 | 91 |
| 92 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_ | 92 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_HANDLE_H_ |
| OLD | NEW |