Chromium Code Reviews| Index: content/browser/storage_partition_impl_map.h |
| diff --git a/content/browser/storage_partition_impl_map.h b/content/browser/storage_partition_impl_map.h |
| index b8ceb43cc38805af3ef4b4fa9745bb14447f3297..916f2009a30bd07cb16efbae2e66585df784144c 100644 |
| --- a/content/browser/storage_partition_impl_map.h |
| +++ b/content/browser/storage_partition_impl_map.h |
| @@ -34,11 +34,57 @@ class StoragePartitionImplMap : public base::SupportsUserData::Data { |
| void ForEach(const BrowserContext::StoragePartitionCallback& callback); |
| private: |
| - typedef std::map<StoragePartitionImpl::StoragePartitionDescriptor, |
| + // Each StoragePartition is uniquely identified by which partition domain |
| + // it belongs to (such as an app or the browser itself), the user supplied |
| + // partition name and the bit indicating whether it should be persisted on |
| + // disk or not. This structure contains those elements and is used as |
| + // uniqueness key to lookup StoragePartition objects in the global map. |
| + // |
| + // TODO(nasko): It is equivalent, though not identical to the same structure |
| + // that lives in chrome profiles. The difference is that this one has |
| + // partition_domain and partition_name separate, while the latter one has |
| + // the path produced by combining the two pieces together. |
| + // The fix for http://crbug.com/159193 will remove the chrome version. |
| + struct StoragePartitionDescriptor { |
|
nasko
2012/11/08 05:03:54
Just FYI, I've renamed the Descriptor to Config in
awong
2012/11/09 02:51:22
Merged.
|
| + const std::string partition_domain; |
| + const std::string partition_name; |
| + const bool in_memory; |
| + |
| + StoragePartitionDescriptor(const std::string& domain, |
| + const std::string& partition, |
| + const bool& in_memory_only) |
| + : partition_domain(domain), |
| + partition_name(partition), |
| + in_memory(in_memory_only) {} |
| + }; |
| + |
| + // Functor for operator <. |
| + struct StoragePartitionDescriptorLess { |
| + bool operator()(const StoragePartitionDescriptor& lhs, |
| + const StoragePartitionDescriptor& rhs) const { |
| + if (lhs.partition_domain != rhs.partition_domain) |
| + return lhs.partition_domain < rhs.partition_domain; |
| + else if (lhs.partition_name != rhs.partition_name) |
| + return lhs.partition_name < rhs.partition_name; |
| + else if (lhs.in_memory != rhs.in_memory) |
| + return lhs.in_memory < rhs.in_memory; |
| + else |
| + return false; |
| + } |
| + }; |
| + |
| + |
| + typedef std::map<StoragePartitionDescriptor, |
| StoragePartitionImpl*, |
| - StoragePartitionImpl::StoragePartitionDescriptorLess> |
| + StoragePartitionDescriptorLess> |
| PartitionsMap; |
| + // Returns the relative path from the profile's base directory, to the |
| + // directory that holds all the state for storage contexts in |
| + // |partition_descriptor|. |
| + static FilePath GetStoragePartitionPath( |
| + const StoragePartitionDescriptor& partition_descriptor); |
| + |
| // This must always be called *after* |partition| has been added to the |
| // partitions_. |
| // |