Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1247)

Unified Diff: content/browser/storage_partition_map.h

Issue 10600009: Support partitioning of storage contexts based on render_id. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebased Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/storage_partition_map.h
diff --git a/content/browser/storage_partition_map.h b/content/browser/storage_partition_map.h
new file mode 100644
index 0000000000000000000000000000000000000000..bcebac1f112ddfb89fe1b63ad168f31a76e09218
--- /dev/null
+++ b/content/browser/storage_partition_map.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_
+#define CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_
+
+#include <map>
+#include <string>
+
+#include "base/callback_forward.h"
+#include "base/supports_user_data.h"
+
+class FilePath;
+
+namespace content {
+
+class BrowserContext;
+class StoragePartition;
+
+// A std::string to StoragePartition map for use with SupportsUserData APIs.
+class StoragePartitionMap : public base::SupportsUserData::Data {
+ public:
+ explicit StoragePartitionMap(BrowserContext* browser_context);
+
+ virtual ~StoragePartitionMap();
+
+ // This map retains ownership of the returned StoragePartition objects.
+ StoragePartition* Get(const std::string& partition_id);
+
+ void ForEach(const base::Callback<void(StoragePartition*)>& callback);
+
+ private:
+ // This must always be called *after* |partition| has been added to the
+ // partitions_.
+ //
+ // TODO(ajwong): Is there a way to make it so that Get()'s implementation
+ // doesn't need to be aware of this ordering? Revisit when refactoring
+ // ResourceContext and AppCache to respect storage partitions.
+ void PostCreateInitialization(StoragePartition* partition,
+ const FilePath& partition_path);
+
+ BrowserContext* browser_context_; // Not Owned.
+ std::map<std::string, StoragePartition*> partitions_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_

Powered by Google App Engine
This is Rietveld 408576698