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