Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 // Disables the exit-time deletion of session-only data. | 67 // Disables the exit-time deletion of session-only data. |
| 68 void SetForceKeepSessionState() { force_keep_session_state_ = true; } | 68 void SetForceKeepSessionState() { force_keep_session_state_ = true; } |
| 69 | 69 |
| 70 // IndexedDBContext implementation: | 70 // IndexedDBContext implementation: |
| 71 base::SequencedTaskRunner* TaskRunner() const override; | 71 base::SequencedTaskRunner* TaskRunner() const override; |
| 72 std::vector<IndexedDBInfo> GetAllOriginsInfo() override; | 72 std::vector<IndexedDBInfo> GetAllOriginsInfo() override; |
| 73 int64_t GetOriginDiskUsage(const GURL& origin_url) override; | 73 int64_t GetOriginDiskUsage(const GURL& origin_url) override; |
| 74 void DeleteForOrigin(const GURL& origin_url) override; | 74 void DeleteForOrigin(const GURL& origin_url) override; |
| 75 void CopyOriginData(const GURL& origin_url, | 75 void CopyOriginData(const GURL& origin_url, |
| 76 IndexedDBContext* dest_context) override; | 76 IndexedDBContext* dest_context) override; |
| 77 base::FilePath GetFilePathForTesting( | 77 base::FilePath GetFilePathForTesting(const GURL& origin_url) const override; |
|
michaeln
2016/03/02 23:51:33
Are you familiar with the url::Origin class? Wdyt
jsbell
2016/03/03 01:11:24
I was chatting about that w/ mkwst@ in https://cod
| |
| 78 const std::string& origin_id) const override; | |
| 79 void SetTaskRunnerForTesting(base::SequencedTaskRunner* task_runner) override; | 78 void SetTaskRunnerForTesting(base::SequencedTaskRunner* task_runner) override; |
| 80 | 79 |
| 81 // Methods called by IndexedDBDispatcherHost for quota support. | 80 // Methods called by IndexedDBDispatcherHost for quota support. |
| 82 void ConnectionOpened(const GURL& origin_url, IndexedDBConnection* db); | 81 void ConnectionOpened(const GURL& origin_url, IndexedDBConnection* db); |
| 83 void ConnectionClosed(const GURL& origin_url, IndexedDBConnection* db); | 82 void ConnectionClosed(const GURL& origin_url, IndexedDBConnection* db); |
| 84 void TransactionComplete(const GURL& origin_url); | 83 void TransactionComplete(const GURL& origin_url); |
| 85 void DatabaseDeleted(const GURL& origin_url); | 84 void DatabaseDeleted(const GURL& origin_url); |
| 86 | 85 |
| 86 static base::FilePath GetBlobStoreFileName(const GURL& origin_url); | |
| 87 static base::FilePath GetLevelDBFileName(const GURL& origin_url); | |
| 88 | |
| 87 // Will be null in unit tests. | 89 // Will be null in unit tests. |
| 88 storage::QuotaManagerProxy* quota_manager_proxy() const { | 90 storage::QuotaManagerProxy* quota_manager_proxy() const { |
| 89 return quota_manager_proxy_.get(); | 91 return quota_manager_proxy_.get(); |
| 90 } | 92 } |
| 91 | 93 |
| 92 // Returns a list of all origins with backing stores. | 94 // Returns a list of all origins with backing stores. |
| 93 std::vector<GURL> GetAllOrigins(); | 95 std::vector<GURL> GetAllOrigins(); |
| 94 bool HasOrigin(const GURL& origin); | 96 bool HasOrigin(const GURL& origin); |
| 95 | 97 |
| 96 // Used by IndexedDBInternalsUI to populate internals page. | 98 // Used by IndexedDBInternalsUI to populate internals page. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 120 private: | 122 private: |
| 121 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearLocalState); | 123 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearLocalState); |
| 122 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearSessionOnlyDatabases); | 124 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearSessionOnlyDatabases); |
| 123 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, SetForceKeepSessionState); | 125 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, SetForceKeepSessionState); |
| 124 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ForceCloseOpenDatabasesOnDelete); | 126 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ForceCloseOpenDatabasesOnDelete); |
| 125 friend class IndexedDBQuotaClientTest; | 127 friend class IndexedDBQuotaClientTest; |
| 126 | 128 |
| 127 typedef std::map<GURL, int64_t> OriginToSizeMap; | 129 typedef std::map<GURL, int64_t> OriginToSizeMap; |
| 128 class IndexedDBGetUsageAndQuotaCallback; | 130 class IndexedDBGetUsageAndQuotaCallback; |
| 129 | 131 |
| 130 base::FilePath GetBlobPath(const std::string& origin_id) const; | 132 base::FilePath GetBlobStorePath(const GURL& origin_url) const; |
|
jsbell
2016/03/02 17:52:56
Added "Store" here just to make it clear this wasn
michaeln
2016/03/02 23:51:33
sgtm
| |
| 131 base::FilePath GetLevelDBPath(const GURL& origin_url) const; | 133 base::FilePath GetLevelDBPath(const GURL& origin_url) const; |
| 132 base::FilePath GetLevelDBPath(const std::string& origin_id) const; | 134 |
| 133 int64_t ReadUsageFromDisk(const GURL& origin_url) const; | 135 int64_t ReadUsageFromDisk(const GURL& origin_url) const; |
| 134 void EnsureDiskUsageCacheInitialized(const GURL& origin_url); | 136 void EnsureDiskUsageCacheInitialized(const GURL& origin_url); |
| 135 void QueryDiskAndUpdateQuotaUsage(const GURL& origin_url); | 137 void QueryDiskAndUpdateQuotaUsage(const GURL& origin_url); |
| 136 base::Time GetOriginLastModified(const GURL& origin_url); | 138 base::Time GetOriginLastModified(const GURL& origin_url); |
| 137 | 139 |
| 138 std::set<GURL>* GetOriginSet(); | 140 std::set<GURL>* GetOriginSet(); |
| 139 bool AddToOriginSet(const GURL& origin_url) { | 141 bool AddToOriginSet(const GURL& origin_url) { |
| 140 return GetOriginSet()->insert(origin_url).second; | 142 return GetOriginSet()->insert(origin_url).second; |
| 141 } | 143 } |
| 142 void RemoveFromOriginSet(const GURL& origin_url) { | 144 void RemoveFromOriginSet(const GURL& origin_url) { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 155 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 157 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 156 scoped_ptr<std::set<GURL> > origin_set_; | 158 scoped_ptr<std::set<GURL> > origin_set_; |
| 157 OriginToSizeMap origin_size_map_; | 159 OriginToSizeMap origin_size_map_; |
| 158 | 160 |
| 159 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl); | 161 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl); |
| 160 }; | 162 }; |
| 161 | 163 |
| 162 } // namespace content | 164 } // namespace content |
| 163 | 165 |
| 164 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ | 166 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ |
| OLD | NEW |