| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 std::unique_ptr<base::DictionaryValue> info( | 172 std::unique_ptr<base::DictionaryValue> info( |
| 173 base::MakeUnique<base::DictionaryValue>()); | 173 base::MakeUnique<base::DictionaryValue>()); |
| 174 info->SetString("url", origin.Serialize()); | 174 info->SetString("url", origin.Serialize()); |
| 175 info->SetString("size", ui::FormatBytes(GetOriginDiskUsage(origin))); | 175 info->SetString("size", ui::FormatBytes(GetOriginDiskUsage(origin))); |
| 176 info->SetDouble("last_modified", GetOriginLastModified(origin).ToJsTime()); | 176 info->SetDouble("last_modified", GetOriginLastModified(origin).ToJsTime()); |
| 177 if (!is_incognito()) { | 177 if (!is_incognito()) { |
| 178 std::unique_ptr<base::ListValue> paths( | 178 std::unique_ptr<base::ListValue> paths( |
| 179 base::MakeUnique<base::ListValue>()); | 179 base::MakeUnique<base::ListValue>()); |
| 180 for (const base::FilePath& path : GetStoragePaths(origin)) | 180 for (const base::FilePath& path : GetStoragePaths(origin)) |
| 181 paths->AppendString(path.value()); | 181 paths->AppendString(path.value()); |
| 182 info->Set("paths", paths.release()); | 182 info->Set("paths", std::move(paths)); |
| 183 } | 183 } |
| 184 info->SetDouble("connection_count", GetConnectionCount(origin)); | 184 info->SetDouble("connection_count", GetConnectionCount(origin)); |
| 185 | 185 |
| 186 // This ends up being O(n^2) since we iterate over all open databases | 186 // This ends up being O(n^2) since we iterate over all open databases |
| 187 // to extract just those in the origin, and we're iterating over all | 187 // to extract just those in the origin, and we're iterating over all |
| 188 // origins in the outer loop. | 188 // origins in the outer loop. |
| 189 | 189 |
| 190 if (factory_.get()) { | 190 if (factory_.get()) { |
| 191 std::pair<IndexedDBFactory::OriginDBMapIterator, | 191 std::pair<IndexedDBFactory::OriginDBMapIterator, |
| 192 IndexedDBFactory::OriginDBMapIterator> | 192 IndexedDBFactory::OriginDBMapIterator> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 "tasks_completed", transaction->diagnostics().tasks_completed); | 253 "tasks_completed", transaction->diagnostics().tasks_completed); |
| 254 | 254 |
| 255 std::unique_ptr<base::ListValue> scope( | 255 std::unique_ptr<base::ListValue> scope( |
| 256 base::MakeUnique<base::ListValue>()); | 256 base::MakeUnique<base::ListValue>()); |
| 257 for (const auto& id : transaction->scope()) { | 257 for (const auto& id : transaction->scope()) { |
| 258 const auto& it = db->metadata().object_stores.find(id); | 258 const auto& it = db->metadata().object_stores.find(id); |
| 259 if (it != db->metadata().object_stores.end()) | 259 if (it != db->metadata().object_stores.end()) |
| 260 scope->AppendString(it->second.name); | 260 scope->AppendString(it->second.name); |
| 261 } | 261 } |
| 262 | 262 |
| 263 transaction_info->Set("scope", scope.release()); | 263 transaction_info->Set("scope", std::move(scope)); |
| 264 transaction_list->Append(std::move(transaction_info)); | 264 transaction_list->Append(std::move(transaction_info)); |
| 265 } | 265 } |
| 266 db_info->Set("transactions", transaction_list.release()); | 266 db_info->Set("transactions", std::move(transaction_list)); |
| 267 | 267 |
| 268 database_list->Append(std::move(db_info)); | 268 database_list->Append(std::move(db_info)); |
| 269 } | 269 } |
| 270 info->Set("databases", database_list.release()); | 270 info->Set("databases", std::move(database_list)); |
| 271 } | 271 } |
| 272 | 272 |
| 273 list->Append(std::move(info)); | 273 list->Append(std::move(info)); |
| 274 } | 274 } |
| 275 return list.release(); | 275 return list.release(); |
| 276 } | 276 } |
| 277 | 277 |
| 278 int IndexedDBContextImpl::GetOriginBlobFileCount(const Origin& origin) { | 278 int IndexedDBContextImpl::GetOriginBlobFileCount(const Origin& origin) { |
| 279 DCHECK(TaskRunner()->RunsTasksInCurrentSequence()); | 279 DCHECK(TaskRunner()->RunsTasksInCurrentSequence()); |
| 280 int count = 0; | 280 int count = 0; |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 void IndexedDBContextImpl::ResetCaches() { | 563 void IndexedDBContextImpl::ResetCaches() { |
| 564 origin_set_.reset(); | 564 origin_set_.reset(); |
| 565 origin_size_map_.clear(); | 565 origin_size_map_.clear(); |
| 566 } | 566 } |
| 567 | 567 |
| 568 base::SequencedTaskRunner* IndexedDBContextImpl::TaskRunner() const { | 568 base::SequencedTaskRunner* IndexedDBContextImpl::TaskRunner() const { |
| 569 return task_runner_.get(); | 569 return task_runner_.get(); |
| 570 } | 570 } |
| 571 | 571 |
| 572 } // namespace content | 572 } // namespace content |
| OLD | NEW |