OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_IMPL_H_ |
6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_IMPL_H_ | 6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "content/public/browser/dom_storage_context.h" | 16 #include "content/public/browser/dom_storage_context.h" |
17 | 17 |
18 class DOMStorageArea; | 18 class DOMStorageArea; |
19 class DOMStorageMessageFilter; | 19 class DOMStorageMessageFilter; |
20 class DOMStorageNamespace; | 20 class DOMStorageNamespace; |
21 | 21 |
| 22 namespace base { |
| 23 class MessageLoopProxy; |
| 24 class SequencedTaskRunner; |
| 25 } |
| 26 |
22 namespace quota { | 27 namespace quota { |
23 class SpecialStoragePolicy; | 28 class SpecialStoragePolicy; |
24 } | 29 } |
25 | 30 |
26 // This is owned by BrowserContext and is all the dom storage information that's | 31 // This is owned by BrowserContext and is all the dom storage information that's |
27 // shared by all the DOMStorageMessageFilters that share the same browser | 32 // shared by all the DOMStorageMessageFilters that share the same browser |
28 // context. The specifics of responsibilities are fairly well documented here | 33 // context. The specifics of responsibilities are fairly well documented here |
29 // and in StorageNamespace and StorageArea. Everything is only to be accessed | 34 // and in StorageNamespace and StorageArea. Everything is only to be accessed |
30 // on the WebKit thread unless noted otherwise. | 35 // on the WebKit thread unless noted otherwise. |
31 class CONTENT_EXPORT DOMStorageContextImpl : | 36 class CONTENT_EXPORT DOMStorageContextImpl : |
32 NON_EXPORTED_BASE(public content::DOMStorageContext) { | 37 NON_EXPORTED_BASE(public content::DOMStorageContext) { |
33 public: | 38 public: |
34 // If |data_path| is empty, nothing will be saved to disk. | 39 // If |data_path| is empty, nothing will be saved to disk. |
35 DOMStorageContextImpl(const FilePath& data_path, | 40 DOMStorageContextImpl(const FilePath& data_path, |
36 quota::SpecialStoragePolicy* special_storage_policy); | 41 quota::SpecialStoragePolicy* special_storage_policy); |
37 virtual ~DOMStorageContextImpl(); | 42 virtual ~DOMStorageContextImpl(); |
38 | 43 |
39 // DOMStorageContext implementation: | 44 // DOMStorageContext implementation: |
| 45 virtual base::SequencedTaskRunner* task_runner() const OVERRIDE; |
40 virtual std::vector<FilePath> GetAllStorageFiles() OVERRIDE; | 46 virtual std::vector<FilePath> GetAllStorageFiles() OVERRIDE; |
41 virtual FilePath GetFilePath(const string16& origin_id) const OVERRIDE; | 47 virtual FilePath GetFilePath(const string16& origin_id) const OVERRIDE; |
42 virtual void DeleteForOrigin(const string16& origin_id) OVERRIDE; | 48 virtual void DeleteForOrigin(const string16& origin_id) OVERRIDE; |
43 virtual void DeleteLocalStorageFile(const FilePath& file_path) OVERRIDE; | 49 virtual void DeleteLocalStorageFile(const FilePath& file_path) OVERRIDE; |
44 virtual void DeleteDataModifiedSince(const base::Time& cutoff) OVERRIDE; | 50 virtual void DeleteDataModifiedSince(const base::Time& cutoff) OVERRIDE; |
45 | 51 |
46 // Invalid storage id. No storage session will ever report this value. | 52 // Invalid storage id. No storage session will ever report this value. |
47 // Used in DOMStorageMessageFilter::OnStorageAreaId when coping with | 53 // Used in DOMStorageMessageFilter::OnStorageAreaId when coping with |
48 // interactions with non-existent storage sessions. | 54 // interactions with non-existent storage sessions. |
49 static const int64 kInvalidStorageId = -1; | 55 static const int64 kInvalidStorageId = -1; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // Maps ids to StorageAreas. We do NOT own these objects. StorageNamespace | 155 // Maps ids to StorageAreas. We do NOT own these objects. StorageNamespace |
150 // (which does own them) will notify us when we should remove the entries. | 156 // (which does own them) will notify us when we should remove the entries. |
151 typedef std::map<int64, DOMStorageArea*> StorageAreaMap; | 157 typedef std::map<int64, DOMStorageArea*> StorageAreaMap; |
152 StorageAreaMap storage_area_map_; | 158 StorageAreaMap storage_area_map_; |
153 | 159 |
154 // Maps ids to StorageNamespaces. We own these objects. | 160 // Maps ids to StorageNamespaces. We own these objects. |
155 typedef std::map<int64, DOMStorageNamespace*> StorageNamespaceMap; | 161 typedef std::map<int64, DOMStorageNamespace*> StorageNamespaceMap; |
156 StorageNamespaceMap storage_namespace_map_; | 162 StorageNamespaceMap storage_namespace_map_; |
157 | 163 |
158 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 164 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
| 165 scoped_refptr<base::MessageLoopProxy> webkit_message_loop_; |
159 | 166 |
160 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextImpl); | 167 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextImpl); |
161 }; | 168 }; |
162 | 169 |
163 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_IMPL_H_ | 170 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_IMPL_H_ |
OLD | NEW |