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 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 5 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
6 | 6 |
| 7 #include <vector> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
9 #include "base/file_util.h" | 11 #include "base/file_util.h" |
10 #include "base/logging.h" | 12 #include "base/logging.h" |
11 #include "base/message_loop_proxy.h" | 13 #include "base/message_loop_proxy.h" |
12 #include "base/string_util.h" | 14 #include "base/string_util.h" |
13 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
14 #include "content/browser/indexed_db/indexed_db_quota_client.h" | 16 #include "content/browser/indexed_db/indexed_db_quota_client.h" |
15 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/browser/indexed_db_info.h" | 18 #include "content/public/browser/indexed_db_info.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 return origins; | 125 return origins; |
124 } | 126 } |
125 | 127 |
126 std::vector<IndexedDBInfo> IndexedDBContextImpl::GetAllOriginsInfo() { | 128 std::vector<IndexedDBInfo> IndexedDBContextImpl::GetAllOriginsInfo() { |
127 std::vector<GURL> origins = GetAllOrigins(); | 129 std::vector<GURL> origins = GetAllOrigins(); |
128 std::vector<IndexedDBInfo> result; | 130 std::vector<IndexedDBInfo> result; |
129 for (std::vector<GURL>::const_iterator iter = origins.begin(); | 131 for (std::vector<GURL>::const_iterator iter = origins.begin(); |
130 iter != origins.end(); ++iter) { | 132 iter != origins.end(); ++iter) { |
131 const GURL& origin = *iter; | 133 const GURL& origin = *iter; |
132 | 134 |
| 135 string16 origin_id = DatabaseUtil::GetOriginIdentifier(origin); |
| 136 base::FilePath idb_directory = GetIndexedDBFilePath(origin_id); |
133 result.push_back(IndexedDBInfo(origin, | 137 result.push_back(IndexedDBInfo(origin, |
134 GetOriginDiskUsage(origin), | 138 GetOriginDiskUsage(origin), |
135 GetOriginLastModified(origin))); | 139 GetOriginLastModified(origin), |
| 140 idb_directory)); |
136 } | 141 } |
137 return result; | 142 return result; |
138 } | 143 } |
139 | 144 |
140 int64 IndexedDBContextImpl::GetOriginDiskUsage(const GURL& origin_url) { | 145 int64 IndexedDBContextImpl::GetOriginDiskUsage(const GURL& origin_url) { |
141 if (data_path_.empty() || !IsInOriginSet(origin_url)) | 146 if (data_path_.empty() || !IsInOriginSet(origin_url)) |
142 return 0; | 147 return 0; |
143 EnsureDiskUsageCacheInitialized(origin_url); | 148 EnsureDiskUsageCacheInitialized(origin_url); |
144 return origin_size_map_[origin_url]; | 149 return origin_size_map_[origin_url]; |
145 } | 150 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 return origin_set_.get(); | 384 return origin_set_.get(); |
380 } | 385 } |
381 | 386 |
382 void IndexedDBContextImpl::ResetCaches() { | 387 void IndexedDBContextImpl::ResetCaches() { |
383 origin_set_.reset(); | 388 origin_set_.reset(); |
384 origin_size_map_.clear(); | 389 origin_size_map_.clear(); |
385 space_available_map_.clear(); | 390 space_available_map_.clear(); |
386 } | 391 } |
387 | 392 |
388 } // namespace content | 393 } // namespace content |
OLD | NEW |