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

Side by Side Diff: content/browser/storage_partition_impl_map.h

Issue 314293003: [Storage] Normalize storage partition path before garbage collection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: export StoragePartitionImplMap Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/storage_partition_impl_map.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/supports_user_data.h" 14 #include "base/supports_user_data.h"
15 #include "content/browser/storage_partition_impl.h" 15 #include "content/browser/storage_partition_impl.h"
16 #include "content/public/browser/browser_context.h" 16 #include "content/public/browser/browser_context.h"
17 17
18 namespace base { 18 namespace base {
19 class FilePath; 19 class FilePath;
20 class SequencedTaskRunner; 20 class SequencedTaskRunner;
21 } // namespace base 21 } // namespace base
22 22
23 namespace content { 23 namespace content {
24 24
25 class BrowserContext; 25 class BrowserContext;
26 26
27 // A std::string to StoragePartition map for use with SupportsUserData APIs. 27 // A std::string to StoragePartition map for use with SupportsUserData APIs.
28 class StoragePartitionImplMap : public base::SupportsUserData::Data { 28 class CONTENT_EXPORT StoragePartitionImplMap
29 : public base::SupportsUserData::Data {
29 public: 30 public:
30 explicit StoragePartitionImplMap(BrowserContext* browser_context); 31 explicit StoragePartitionImplMap(BrowserContext* browser_context);
31 32
32 virtual ~StoragePartitionImplMap(); 33 virtual ~StoragePartitionImplMap();
33 34
34 // This map retains ownership of the returned StoragePartition objects. 35 // This map retains ownership of the returned StoragePartition objects.
35 StoragePartitionImpl* Get(const std::string& partition_domain, 36 StoragePartitionImpl* Get(const std::string& partition_domain,
36 const std::string& partition_name, 37 const std::string& partition_name,
37 bool in_memory); 38 bool in_memory);
38 39
(...skipping 11 matching lines...) Expand all
50 // 51 //
51 // The |done| closure is executed on the calling thread when garbage 52 // The |done| closure is executed on the calling thread when garbage
52 // collection is complete. 53 // collection is complete.
53 void GarbageCollect(scoped_ptr<base::hash_set<base::FilePath> > active_paths, 54 void GarbageCollect(scoped_ptr<base::hash_set<base::FilePath> > active_paths,
54 const base::Closure& done); 55 const base::Closure& done);
55 56
56 void ForEach(const BrowserContext::StoragePartitionCallback& callback); 57 void ForEach(const BrowserContext::StoragePartitionCallback& callback);
57 58
58 private: 59 private:
59 FRIEND_TEST_ALL_PREFIXES(StoragePartitionConfigTest, OperatorLess); 60 FRIEND_TEST_ALL_PREFIXES(StoragePartitionConfigTest, OperatorLess);
61 FRIEND_TEST_ALL_PREFIXES(StoragePartitionImplMapTest, GarbageCollect);
60 62
61 // Each StoragePartition is uniquely identified by which partition domain 63 // Each StoragePartition is uniquely identified by which partition domain
62 // it belongs to (such as an app or the browser itself), the user supplied 64 // it belongs to (such as an app or the browser itself), the user supplied
63 // partition name and the bit indicating whether it should be persisted on 65 // partition name and the bit indicating whether it should be persisted on
64 // disk or not. This structure contains those elements and is used as 66 // disk or not. This structure contains those elements and is used as
65 // uniqueness key to lookup StoragePartition objects in the global map. 67 // uniqueness key to lookup StoragePartition objects in the global map.
66 // 68 //
67 // TODO(nasko): It is equivalent, though not identical to the same structure 69 // TODO(nasko): It is equivalent, though not identical to the same structure
68 // that lives in chrome profiles. The difference is that this one has 70 // that lives in chrome profiles. The difference is that this one has
69 // partition_domain and partition_name separate, while the latter one has 71 // partition_domain and partition_name separate, while the latter one has
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 PartitionMap partitions_; 125 PartitionMap partitions_;
124 126
125 // Set to true when the ResourceContext for the associated |browser_context_| 127 // Set to true when the ResourceContext for the associated |browser_context_|
126 // is initialized. Can never return to false. 128 // is initialized. Can never return to false.
127 bool resource_context_initialized_; 129 bool resource_context_initialized_;
128 }; 130 };
129 131
130 } // namespace content 132 } // namespace content
131 133
132 #endif // CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_ 134 #endif // CONTENT_BROWSER_STORAGE_PARTITION_MAP_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/storage_partition_impl_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698