| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CONTEXT_WRAPPER_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.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" |
| 11 #include "content/browser/service_worker/service_worker_context.h" | 11 #include "content/browser/service_worker/service_worker_context.h" |
| 12 #include "content/common/content_export.h" |
| 12 | 13 |
| 13 namespace base { | 14 namespace base { |
| 14 class FilePath; | 15 class FilePath; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace quota { | 18 namespace quota { |
| 18 class QuotaManagerProxy; | 19 class QuotaManagerProxy; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace content { | 22 namespace content { |
| 22 | 23 |
| 23 class ServiceWorkerContextCore; | 24 class ServiceWorkerContextCore; |
| 24 | 25 |
| 25 // A refcounted wrapper class for our core object. Higher level content lib | 26 // A refcounted wrapper class for our core object. Higher level content lib |
| 26 // classes keep references to this class on mutliple threads. The inner core | 27 // classes keep references to this class on mutliple threads. The inner core |
| 27 // instance is strictly single threaded and is not refcounted, the core object | 28 // instance is strictly single threaded and is not refcounted, the core object |
| 28 // is what is used internally in the service worker lib. | 29 // is what is used internally in the service worker lib. |
| 29 class ServiceWorkerContextWrapper | 30 class CONTENT_EXPORT ServiceWorkerContextWrapper |
| 30 : NON_EXPORTED_BASE(public ServiceWorkerContext), | 31 : NON_EXPORTED_BASE(public ServiceWorkerContext), |
| 31 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> { | 32 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> { |
| 32 public: | 33 public: |
| 33 ServiceWorkerContextWrapper(); | 34 ServiceWorkerContextWrapper(); |
| 34 | 35 |
| 35 // Init and Shutdown are for use on the UI thread when the profile, | 36 // Init and Shutdown are for use on the UI thread when the profile, |
| 36 // storagepartition is being setup and torn down. | 37 // storagepartition is being setup and torn down. |
| 37 void Init(const base::FilePath& user_data_directory, | 38 void Init(const base::FilePath& user_data_directory, |
| 38 quota::QuotaManagerProxy* quota_manager_proxy); | 39 quota::QuotaManagerProxy* quota_manager_proxy); |
| 39 void Shutdown(); | 40 void Shutdown(); |
| 40 | 41 |
| 41 // The core context is only for use on the IO thread. | 42 // The core context is only for use on the IO thread. |
| 42 ServiceWorkerContextCore* context(); | 43 ServiceWorkerContextCore* context(); |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; | 46 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; |
| 46 virtual ~ServiceWorkerContextWrapper(); | 47 virtual ~ServiceWorkerContextWrapper(); |
| 47 | 48 |
| 48 scoped_ptr<ServiceWorkerContextCore> context_core_; | 49 scoped_ptr<ServiceWorkerContextCore> context_core_; |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 } // namespace content | 52 } // namespace content |
| 52 | 53 |
| 53 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 54 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
| OLD | NEW |