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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 115 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
116 std::vector<GURL> origins; | 116 std::vector<GURL> origins; |
117 std::set<GURL>* origins_set = GetOriginSet(); | 117 std::set<GURL>* origins_set = GetOriginSet(); |
118 for (std::set<GURL>::const_iterator iter = origins_set->begin(); | 118 for (std::set<GURL>::const_iterator iter = origins_set->begin(); |
119 iter != origins_set->end(); ++iter) { | 119 iter != origins_set->end(); ++iter) { |
120 origins.push_back(*iter); | 120 origins.push_back(*iter); |
121 } | 121 } |
122 return origins; | 122 return origins; |
123 } | 123 } |
124 | 124 |
| 125 std::vector<IndexedDBInfo> IndexedDBContextImpl::GetAllOriginsInfo() { |
| 126 std::vector<GURL> origins = GetAllOrigins(); |
| 127 std::vector<IndexedDBInfo> result; |
| 128 for (std::vector<GURL>::const_iterator iter = origins.begin(); |
| 129 iter != origins.end(); ++iter) { |
| 130 const GURL& origin = *iter; |
| 131 |
| 132 IndexedDBInfo info = { origin, |
| 133 GetOriginDiskUsage(origin), |
| 134 GetOriginLastModified(origin) }; |
| 135 result.push_back(info); |
| 136 } |
| 137 return result; |
| 138 } |
| 139 |
125 int64 IndexedDBContextImpl::GetOriginDiskUsage(const GURL& origin_url) { | 140 int64 IndexedDBContextImpl::GetOriginDiskUsage(const GURL& origin_url) { |
126 if (data_path_.empty() || !IsInOriginSet(origin_url)) | 141 if (data_path_.empty() || !IsInOriginSet(origin_url)) |
127 return 0; | 142 return 0; |
128 EnsureDiskUsageCacheInitialized(origin_url); | 143 EnsureDiskUsageCacheInitialized(origin_url); |
129 return origin_size_map_[origin_url]; | 144 return origin_size_map_[origin_url]; |
130 } | 145 } |
131 | 146 |
132 base::Time IndexedDBContextImpl::GetOriginLastModified(const GURL& origin_url) { | 147 base::Time IndexedDBContextImpl::GetOriginLastModified(const GURL& origin_url) { |
133 if (data_path_.empty() || !IsInOriginSet(origin_url)) | 148 if (data_path_.empty() || !IsInOriginSet(origin_url)) |
134 return base::Time(); | 149 return base::Time(); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 return origin_set_.get(); | 379 return origin_set_.get(); |
365 } | 380 } |
366 | 381 |
367 void IndexedDBContextImpl::ResetCaches() { | 382 void IndexedDBContextImpl::ResetCaches() { |
368 origin_set_.reset(); | 383 origin_set_.reset(); |
369 origin_size_map_.clear(); | 384 origin_size_map_.clear(); |
370 space_available_map_.clear(); | 385 space_available_map_.clear(); |
371 } | 386 } |
372 | 387 |
373 } // namespace content | 388 } // namespace content |
OLD | NEW |