OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_WORKER_HOST_WORKER_STORAGE_PARTITION_H_ | |
6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_STORAGE_PARTITION_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 | |
10 class ChromeAppCacheService; | |
11 class IndexedDBContextImpl; | |
12 | |
13 namespace fileapi { | |
14 class FileSystemContext; | |
15 } // namespace fileapi | |
16 | |
17 namespace webkit_database { | |
18 class DatabaseTracker; | |
19 } // namespace webkit_database | |
20 | |
21 // Contains the data from StoragePartition for use by Worker APIs. | |
22 // | |
23 // StoragePartition meant for the UI so we can't use it directly in many | |
24 // Worker APIs that run on teh IO thread. While we could make it RefCounted, | |
piman
2012/09/11 03:27:01
typo: teh->the
| |
25 // the Worker system is the only place that really needs access on the IO | |
26 // thread. Instead of changing the lifetime semantics of StoragePartition, | |
27 // we just create a parallel struct here to simplify the APIs of various | |
28 // methods in WorkerServiceImpl. | |
29 // | |
30 // This class is effectively a struct, but we make it a class because we want to | |
31 // define copy constructors, assignment operators, and an Equals() function for | |
32 // it which makes it look awkward as a struct. | |
33 class WorkerStoragePartition { | |
34 public: | |
35 WorkerStoragePartition(ChromeAppCacheService* appcache_service, | |
36 fileapi::FileSystemContext* filesystem_context, | |
37 webkit_database::DatabaseTracker* database_tracker, | |
38 IndexedDBContextImpl* indexed_db_context); | |
39 ~WorkerStoragePartition(); | |
40 | |
41 // Declaring so these don't get inlined which has the unfortunate effect of | |
42 // requiring all including classes to have the full definition of every member | |
43 // type. | |
44 WorkerStoragePartition(const WorkerStoragePartition& other); | |
45 const WorkerStoragePartition& operator=(const WorkerStoragePartition& rhs); | |
46 | |
47 bool Equals(const WorkerStoragePartition& other) const; | |
48 | |
49 ChromeAppCacheService* appcache_service() const { | |
50 return appcache_service_.get(); | |
51 } | |
52 | |
53 fileapi::FileSystemContext* filesystem_context() const { | |
54 return filesystem_context_.get(); | |
55 } | |
56 | |
57 webkit_database::DatabaseTracker* database_tracker() const { | |
58 return database_tracker_.get(); | |
59 } | |
60 | |
61 IndexedDBContextImpl* indexed_db_context() const { | |
62 return indexed_db_context_.get(); | |
63 } | |
64 | |
65 private: | |
66 void Copy(const WorkerStoragePartition& other); | |
67 | |
68 scoped_refptr<ChromeAppCacheService> appcache_service_; | |
69 scoped_refptr<fileapi::FileSystemContext> filesystem_context_; | |
70 scoped_refptr<webkit_database::DatabaseTracker> database_tracker_; | |
71 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; | |
72 }; | |
73 | |
74 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_STORAGE_PARTITION_H_ | |
OLD | NEW |