Index: content/browser/storage_partition_impl.h |
diff --git a/content/browser/storage_partition_impl.h b/content/browser/storage_partition_impl.h |
index d3d6dba1593d368802e53d6a84cf76acb440e7ca..d815ec641ebc63ed35a47204f435849f1aa6145d 100644 |
--- a/content/browser/storage_partition_impl.h |
+++ b/content/browser/storage_partition_impl.h |
@@ -17,13 +17,51 @@ namespace content { |
class StoragePartitionImpl : public StoragePartition { |
public: |
+ // 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. |
+ // |
+ // Note: 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. |
awong
2012/11/02 21:56:13
Cite bug 159193 as the fix for this forkage.
nasko
2012/11/03 00:36:24
Done.
|
+ struct StoragePartitionDescriptor { |
+ 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) {} |
+ }; |
awong
2012/11/02 21:56:13
need newline.
nasko
2012/11/03 00:36:24
Done.
|
+ // Functor for operator <. |
+ struct StoragePartitionDescriptorLess { |
awong
2012/11/02 21:56:13
Can this type be private?
nasko
2012/11/03 00:36:24
Done.
|
+ 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; |
+ } |
+ }; |
+ |
virtual ~StoragePartitionImpl(); |
// TODO(ajwong): Break the direct dependency on |context|. We only |
// need 3 pieces of info from it. |
- static StoragePartitionImpl* Create(BrowserContext* context, |
- const std::string& partition_id, |
- const FilePath& profile_path); |
+ static StoragePartitionImpl* Create( |
+ BrowserContext* context, |
+ const StoragePartitionDescriptor& partition_id, |
awong
2012/11/02 21:56:13
What's your thoughts on hiding the Descriptor stru
nasko
2012/11/03 00:36:24
Create is only called by SPIM::Get, so it is not r
|
+ const FilePath& profile_path); |
// StoragePartition interface. |
virtual FilePath GetPath() OVERRIDE; |
@@ -39,6 +77,12 @@ class StoragePartitionImpl : public StoragePartition { |
private: |
friend class StoragePartitionImplMap; |
+ // 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); |
+ |
StoragePartitionImpl( |
const FilePath& partition_path, |
quota::QuotaManager* quota_manager, |