| 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_HANDLE_REFERENCE_H_ | 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_HANDLE_REFERENCE_H_ |
| 6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_HANDLE_REFERENCE_H_ | 6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_HANDLE_REFERENCE_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/content_export.h" |
| 10 #include "content/common/service_worker/service_worker_types.h" | 11 #include "content/common/service_worker/service_worker_types.h" |
| 11 | 12 |
| 12 namespace content { | 13 namespace content { |
| 13 | 14 |
| 14 class ThreadSafeSender; | 15 class ThreadSafeSender; |
| 15 | 16 |
| 16 // Represents an interprocess reference to ServiceWorkerHandle managed in the | 17 // Represents an interprocess reference to ServiceWorkerHandle managed in the |
| 17 // browser process. The constructor and destructor sends a message to increment | 18 // browser process. The constructor and destructor sends a message to increment |
| 18 // or decrement the reference count to the browser process. | 19 // or decrement the reference count to the browser process. |
| 19 class ServiceWorkerHandleReference { | 20 class CONTENT_EXPORT ServiceWorkerHandleReference { |
| 20 public: | 21 public: |
| 21 // Creates a new ServiceWorkerHandleReference and increments ref-count. | 22 // Creates a new ServiceWorkerHandleReference and increments ref-count. |
| 22 static scoped_ptr<ServiceWorkerHandleReference> Create( | 23 static scoped_ptr<ServiceWorkerHandleReference> Create( |
| 23 const ServiceWorkerObjectInfo& info, | 24 const ServiceWorkerObjectInfo& info, |
| 24 ThreadSafeSender* sender); | 25 ThreadSafeSender* sender); |
| 25 | 26 |
| 26 // Creates a new ServiceWorkerHandleReference by adopting a ref-count. | 27 // Creates a new ServiceWorkerHandleReference by adopting a ref-count. |
| 27 static scoped_ptr<ServiceWorkerHandleReference> Adopt( | 28 static scoped_ptr<ServiceWorkerHandleReference> Adopt( |
| 28 const ServiceWorkerObjectInfo& info, | 29 const ServiceWorkerObjectInfo& info, |
| 29 ThreadSafeSender* sender); | 30 ThreadSafeSender* sender); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 42 ThreadSafeSender* sender, | 43 ThreadSafeSender* sender, |
| 43 bool increment_ref_in_ctor); | 44 bool increment_ref_in_ctor); |
| 44 ServiceWorkerObjectInfo info_; | 45 ServiceWorkerObjectInfo info_; |
| 45 scoped_refptr<ThreadSafeSender> sender_; | 46 scoped_refptr<ThreadSafeSender> sender_; |
| 46 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandleReference); | 47 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandleReference); |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 } // namespace content | 50 } // namespace content |
| 50 | 51 |
| 51 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_HANDLE_REFERENCE_H_ | 52 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_HANDLE_REFERENCE_H_ |
| OLD | NEW |