| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_STORAGE_PARTITION_MAP_H_ | 5 #ifndef CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ |
| 6 #define CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ | 6 #define CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 public: | 25 public: |
| 26 explicit StoragePartitionImplMap(BrowserContext* browser_context); | 26 explicit StoragePartitionImplMap(BrowserContext* browser_context); |
| 27 | 27 |
| 28 virtual ~StoragePartitionImplMap(); | 28 virtual ~StoragePartitionImplMap(); |
| 29 | 29 |
| 30 // This map retains ownership of the returned StoragePartition objects. | 30 // This map retains ownership of the returned StoragePartition objects. |
| 31 StoragePartitionImpl* Get(const std::string& partition_domain, | 31 StoragePartitionImpl* Get(const std::string& partition_domain, |
| 32 const std::string& partition_name, | 32 const std::string& partition_name, |
| 33 bool in_memory); | 33 bool in_memory); |
| 34 | 34 |
| 35 // Starts an asynchronous best-effort attempt to delete all on-disk storage |
| 36 // related to |site|, avoiding any directories that are known to be in use. |
| 37 void AsyncObliterate(const GURL& site); |
| 38 |
| 35 void ForEach(const BrowserContext::StoragePartitionCallback& callback); | 39 void ForEach(const BrowserContext::StoragePartitionCallback& callback); |
| 36 | 40 |
| 37 private: | 41 private: |
| 38 FRIEND_TEST_ALL_PREFIXES(StoragePartitionConfigTest, OperatorLess); | 42 FRIEND_TEST_ALL_PREFIXES(StoragePartitionConfigTest, OperatorLess); |
| 39 | 43 |
| 40 // Each StoragePartition is uniquely identified by which partition domain | 44 // Each StoragePartition is uniquely identified by which partition domain |
| 41 // it belongs to (such as an app or the browser itself), the user supplied | 45 // it belongs to (such as an app or the browser itself), the user supplied |
| 42 // partition name and the bit indicating whether it should be persisted on | 46 // partition name and the bit indicating whether it should be persisted on |
| 43 // disk or not. This structure contains those elements and is used as | 47 // disk or not. This structure contains those elements and is used as |
| 44 // uniqueness key to lookup StoragePartition objects in the global map. | 48 // uniqueness key to lookup StoragePartition objects in the global map. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // |partition_domain| and |partition_name|. | 90 // |partition_domain| and |partition_name|. |
| 87 static FilePath GetStoragePartitionPath(const std::string& partition_domain, | 91 static FilePath GetStoragePartitionPath(const std::string& partition_domain, |
| 88 const std::string& partition_name); | 92 const std::string& partition_name); |
| 89 | 93 |
| 90 // This must always be called *after* |partition| has been added to the | 94 // This must always be called *after* |partition| has been added to the |
| 91 // partitions_. | 95 // partitions_. |
| 92 // | 96 // |
| 93 // TODO(ajwong): Is there a way to make it so that Get()'s implementation | 97 // TODO(ajwong): Is there a way to make it so that Get()'s implementation |
| 94 // doesn't need to be aware of this ordering? Revisit when refactoring | 98 // doesn't need to be aware of this ordering? Revisit when refactoring |
| 95 // ResourceContext and AppCache to respect storage partitions. | 99 // ResourceContext and AppCache to respect storage partitions. |
| 96 void PostCreateInitialization(StoragePartitionImpl* partition); | 100 void PostCreateInitialization(StoragePartitionImpl* partition, |
| 101 bool in_memory); |
| 97 | 102 |
| 98 BrowserContext* browser_context_; // Not Owned. | 103 BrowserContext* browser_context_; // Not Owned. |
| 99 PartitionMap partitions_; | 104 PartitionMap partitions_; |
| 100 | 105 |
| 101 // Set to true when the ResourceContext for the associated |browser_context_| | 106 // Set to true when the ResourceContext for the associated |browser_context_| |
| 102 // is initialized. Can never return to false. | 107 // is initialized. Can never return to false. |
| 103 bool resource_context_initialized_; | 108 bool resource_context_initialized_; |
| 104 }; | 109 }; |
| 105 | 110 |
| 106 } // namespace content | 111 } // namespace content |
| 107 | 112 |
| 108 #endif // CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ | 113 #endif // CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ |
| OLD | NEW |