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, | |
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() { return appcache_service_.get(); } | |
michaeln
2012/09/11 01:37:31
I think these getters can all be const...
Foo* foo
awong
2012/09/11 03:15:20
Done.
| |
50 | |
51 fileapi::FileSystemContext* filesystem_context() { | |
52 return filesystem_context_.get(); | |
53 } | |
54 | |
55 webkit_database::DatabaseTracker* database_tracker() { | |
56 return database_tracker_.get(); | |
57 } | |
58 | |
59 IndexedDBContextImpl* indexed_db_context() { | |
60 return indexed_db_context_.get(); | |
61 } | |
62 | |
63 private: | |
64 void Copy(const WorkerStoragePartition& other); | |
65 | |
66 scoped_refptr<ChromeAppCacheService> appcache_service_; | |
67 scoped_refptr<fileapi::FileSystemContext> filesystem_context_; | |
68 scoped_refptr<webkit_database::DatabaseTracker> database_tracker_; | |
69 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; | |
70 }; | |
71 | |
72 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_STORAGE_PARTITION_H_ | |
OLD | NEW |