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 <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 IndexedDBInfo(GURL(origin.Serialize()), GetOriginDiskUsage(origin), | 153 IndexedDBInfo(GURL(origin.Serialize()), GetOriginDiskUsage(origin), |
154 GetOriginLastModified(origin), connection_count)); | 154 GetOriginLastModified(origin), connection_count)); |
155 } | 155 } |
156 return result; | 156 return result; |
157 } | 157 } |
158 | 158 |
159 static bool HostNameComparator(const Origin& i, const Origin& j) { | 159 static bool HostNameComparator(const Origin& i, const Origin& j) { |
160 return i.host() < j.host(); | 160 return i.host() < j.host(); |
161 } | 161 } |
162 | 162 |
| 163 #if 0 |
163 base::ListValue* IndexedDBContextImpl::GetAllOriginsDetails() { | 164 base::ListValue* IndexedDBContextImpl::GetAllOriginsDetails() { |
164 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); | 165 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); |
165 std::vector<Origin> origins = GetAllOrigins(); | 166 std::vector<Origin> origins = GetAllOrigins(); |
166 | 167 |
167 std::sort(origins.begin(), origins.end(), HostNameComparator); | 168 std::sort(origins.begin(), origins.end(), HostNameComparator); |
168 | 169 |
169 std::unique_ptr<base::ListValue> list(new base::ListValue()); | 170 std::unique_ptr<base::ListValue> list(new base::ListValue()); |
170 for (const auto& origin : origins) { | 171 for (const auto& origin : origins) { |
171 std::unique_ptr<base::DictionaryValue> info(new base::DictionaryValue()); | 172 std::unique_ptr<base::DictionaryValue> info(new base::DictionaryValue()); |
172 info->SetString("url", origin.Serialize()); | 173 info->SetString("url", origin.Serialize()); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 273 |
273 database_list->Append(std::move(db_info)); | 274 database_list->Append(std::move(db_info)); |
274 } | 275 } |
275 info->Set("databases", database_list.release()); | 276 info->Set("databases", database_list.release()); |
276 } | 277 } |
277 | 278 |
278 list->Append(std::move(info)); | 279 list->Append(std::move(info)); |
279 } | 280 } |
280 return list.release(); | 281 return list.release(); |
281 } | 282 } |
| 283 #endif |
282 | 284 |
283 int IndexedDBContextImpl::GetOriginBlobFileCount(const Origin& origin) { | 285 int IndexedDBContextImpl::GetOriginBlobFileCount(const Origin& origin) { |
284 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); | 286 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); |
285 int count = 0; | 287 int count = 0; |
286 base::FileEnumerator file_enumerator(GetBlobStorePath(origin), true, | 288 base::FileEnumerator file_enumerator(GetBlobStorePath(origin), true, |
287 base::FileEnumerator::FILES); | 289 base::FileEnumerator::FILES); |
288 for (base::FilePath file_path = file_enumerator.Next(); !file_path.empty(); | 290 for (base::FilePath file_path = file_enumerator.Next(); !file_path.empty(); |
289 file_path = file_enumerator.Next()) { | 291 file_path = file_enumerator.Next()) { |
290 count++; | 292 count++; |
291 } | 293 } |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 void IndexedDBContextImpl::ResetCaches() { | 571 void IndexedDBContextImpl::ResetCaches() { |
570 origin_set_.reset(); | 572 origin_set_.reset(); |
571 origin_size_map_.clear(); | 573 origin_size_map_.clear(); |
572 } | 574 } |
573 | 575 |
574 base::SequencedTaskRunner* IndexedDBContextImpl::TaskRunner() const { | 576 base::SequencedTaskRunner* IndexedDBContextImpl::TaskRunner() const { |
575 return task_runner_.get(); | 577 return task_runner_.get(); |
576 } | 578 } |
577 | 579 |
578 } // namespace content | 580 } // namespace content |
OLD | NEW |