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

Side by Side Diff: content/browser/indexed_db/indexed_db_context_impl.h

Issue 671873004: Migrates legacy packaged app data when it's upgraded to a platform app (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses review comments Created 6 years 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
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_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 27 matching lines...) Expand all
38 class IndexedDBConnection; 38 class IndexedDBConnection;
39 39
40 class CONTENT_EXPORT IndexedDBContextImpl 40 class CONTENT_EXPORT IndexedDBContextImpl
41 : NON_EXPORTED_BASE(public IndexedDBContext) { 41 : NON_EXPORTED_BASE(public IndexedDBContext) {
42 public: 42 public:
43 // Recorded in histograms, so append only. 43 // Recorded in histograms, so append only.
44 enum ForceCloseReason { 44 enum ForceCloseReason {
45 FORCE_CLOSE_DELETE_ORIGIN = 0, 45 FORCE_CLOSE_DELETE_ORIGIN = 0,
46 FORCE_CLOSE_BACKING_STORE_FAILURE, 46 FORCE_CLOSE_BACKING_STORE_FAILURE,
47 FORCE_CLOSE_INTERNALS_PAGE, 47 FORCE_CLOSE_INTERNALS_PAGE,
48 FORCE_CLOSE_COPY_ORIGIN,
48 FORCE_CLOSE_REASON_MAX 49 FORCE_CLOSE_REASON_MAX
49 }; 50 };
50 51
51 // The indexed db directory. 52 // The indexed db directory.
52 static const base::FilePath::CharType kIndexedDBDirectory[]; 53 static const base::FilePath::CharType kIndexedDBDirectory[];
53 54
54 // If |data_path| is empty, nothing will be saved to disk. 55 // If |data_path| is empty, nothing will be saved to disk.
55 IndexedDBContextImpl(const base::FilePath& data_path, 56 IndexedDBContextImpl(const base::FilePath& data_path,
56 storage::SpecialStoragePolicy* special_storage_policy, 57 storage::SpecialStoragePolicy* special_storage_policy,
57 storage::QuotaManagerProxy* quota_manager_proxy, 58 storage::QuotaManagerProxy* quota_manager_proxy,
58 base::SequencedTaskRunner* task_runner); 59 base::SequencedTaskRunner* task_runner);
59 60
60 IndexedDBFactory* GetIDBFactory(); 61 IndexedDBFactory* GetIDBFactory();
61 62
62 // Disables the exit-time deletion of session-only data. 63 // Disables the exit-time deletion of session-only data.
63 void SetForceKeepSessionState() { force_keep_session_state_ = true; } 64 void SetForceKeepSessionState() { force_keep_session_state_ = true; }
64 65
65 // IndexedDBContext implementation: 66 // IndexedDBContext implementation:
66 base::SequencedTaskRunner* TaskRunner() const override; 67 base::SequencedTaskRunner* TaskRunner() const override;
67 std::vector<IndexedDBInfo> GetAllOriginsInfo() override; 68 std::vector<IndexedDBInfo> GetAllOriginsInfo() override;
68 int64 GetOriginDiskUsage(const GURL& origin_url) override; 69 int64 GetOriginDiskUsage(const GURL& origin_url) override;
69 void DeleteForOrigin(const GURL& origin_url) override; 70 void DeleteForOrigin(const GURL& origin_url) override;
71 void CopyOriginData(const GURL& origin_url,
72 IndexedDBContext* dest_context) override;
70 base::FilePath GetFilePathForTesting( 73 base::FilePath GetFilePathForTesting(
71 const std::string& origin_id) const override; 74 const std::string& origin_id) const override;
72 void SetTaskRunnerForTesting(base::SequencedTaskRunner* task_runner) override; 75 void SetTaskRunnerForTesting(base::SequencedTaskRunner* task_runner) override;
73 76
74 // Methods called by IndexedDBDispatcherHost for quota support. 77 // Methods called by IndexedDBDispatcherHost for quota support.
75 void ConnectionOpened(const GURL& origin_url, IndexedDBConnection* db); 78 void ConnectionOpened(const GURL& origin_url, IndexedDBConnection* db);
76 void ConnectionClosed(const GURL& origin_url, IndexedDBConnection* db); 79 void ConnectionClosed(const GURL& origin_url, IndexedDBConnection* db);
77 void TransactionComplete(const GURL& origin_url); 80 void TransactionComplete(const GURL& origin_url);
78 void DatabaseDeleted(const GURL& origin_url); 81 void DatabaseDeleted(const GURL& origin_url);
79 bool WouldBeOverQuota(const GURL& origin_url, int64 additional_bytes); 82 bool WouldBeOverQuota(const GURL& origin_url, int64 additional_bytes);
80 bool IsOverQuota(const GURL& origin_url); 83 bool IsOverQuota(const GURL& origin_url);
81 84
82 storage::QuotaManagerProxy* quota_manager_proxy(); 85 storage::QuotaManagerProxy* quota_manager_proxy();
83 86
84 std::vector<GURL> GetAllOrigins(); 87 std::vector<GURL> GetAllOrigins();
85 base::Time GetOriginLastModified(const GURL& origin_url); 88 base::Time GetOriginLastModified(const GURL& origin_url);
86 base::ListValue* GetAllOriginsDetails(); 89 base::ListValue* GetAllOriginsDetails();
87 90
88 // ForceClose takes a value rather than a reference since it may release the 91 // ForceClose takes a value rather than a reference since it may release the
89 // owning object. 92 // owning object.
90 void ForceClose(const GURL origin_url, ForceCloseReason reason); 93 void ForceClose(const GURL origin_url, ForceCloseReason reason);
91 // GetStoragePaths returns all paths owned by this database, in arbitrary 94 // GetStoragePaths returns all paths owned by this database, in arbitrary
92 // order. 95 // order.
93 std::vector<base::FilePath> GetStoragePaths(const GURL& origin_url) const; 96 std::vector<base::FilePath> GetStoragePaths(const GURL& origin_url) const;
97
94 base::FilePath data_path() const { return data_path_; } 98 base::FilePath data_path() const { return data_path_; }
95 bool IsInOriginSet(const GURL& origin_url) { 99 bool IsInOriginSet(const GURL& origin_url) {
96 std::set<GURL>* set = GetOriginSet(); 100 std::set<GURL>* set = GetOriginSet();
97 return set->find(origin_url) != set->end(); 101 return set->find(origin_url) != set->end();
98 } 102 }
99 size_t GetConnectionCount(const GURL& origin_url); 103 size_t GetConnectionCount(const GURL& origin_url);
100 104
101 // For unit tests allow to override the |data_path_|. 105 // For unit tests allow to override the |data_path_|.
102 void set_data_path_for_testing(const base::FilePath& data_path) { 106 void set_data_path_for_testing(const base::FilePath& data_path) {
103 data_path_ = data_path; 107 data_path_ = data_path;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 scoped_ptr<std::set<GURL> > origin_set_; 156 scoped_ptr<std::set<GURL> > origin_set_;
153 OriginToSizeMap origin_size_map_; 157 OriginToSizeMap origin_size_map_;
154 OriginToSizeMap space_available_map_; 158 OriginToSizeMap space_available_map_;
155 159
156 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl); 160 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl);
157 }; 161 };
158 162
159 } // namespace content 163 } // namespace content
160 164
161 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ 165 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698