| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "webkit/browser/quota/quota_manager.h" | 5 #include "webkit/browser/quota/quota_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <functional> | 9 #include <functional> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 GetUsageTracker(type)->GetGlobalUsage(callback); | 1069 GetUsageTracker(type)->GetGlobalUsage(callback); |
| 1070 } | 1070 } |
| 1071 | 1071 |
| 1072 void QuotaManager::GetHostUsage(const std::string& host, | 1072 void QuotaManager::GetHostUsage(const std::string& host, |
| 1073 StorageType type, | 1073 StorageType type, |
| 1074 const UsageCallback& callback) { | 1074 const UsageCallback& callback) { |
| 1075 LazyInitialize(); | 1075 LazyInitialize(); |
| 1076 GetUsageTracker(type)->GetHostUsage(host, callback); | 1076 GetUsageTracker(type)->GetHostUsage(host, callback); |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 void QuotaManager::GetHostUsage(const std::string& host, |
| 1080 StorageType type, |
| 1081 QuotaClient::ID client_id, |
| 1082 const UsageCallback& callback) { |
| 1083 LazyInitialize(); |
| 1084 ClientUsageTracker* tracker = |
| 1085 GetUsageTracker(type)->GetClientTracker(client_id); |
| 1086 if (!tracker) { |
| 1087 callback.Run(0); |
| 1088 return; |
| 1089 } |
| 1090 tracker->GetHostUsage(host, callback); |
| 1091 } |
| 1092 |
| 1079 void QuotaManager::GetStatistics( | 1093 void QuotaManager::GetStatistics( |
| 1080 std::map<std::string, std::string>* statistics) { | 1094 std::map<std::string, std::string>* statistics) { |
| 1081 DCHECK(statistics); | 1095 DCHECK(statistics); |
| 1082 if (temporary_storage_evictor_) { | 1096 if (temporary_storage_evictor_) { |
| 1083 std::map<std::string, int64> stats; | 1097 std::map<std::string, int64> stats; |
| 1084 temporary_storage_evictor_->GetStatistics(&stats); | 1098 temporary_storage_evictor_->GetStatistics(&stats); |
| 1085 for (std::map<std::string, int64>::iterator p = stats.begin(); | 1099 for (std::map<std::string, int64>::iterator p = stats.begin(); |
| 1086 p != stats.end(); | 1100 p != stats.end(); |
| 1087 ++p) | 1101 ++p) |
| 1088 (*statistics)[p->first] = base::Int64ToString(p->second); | 1102 (*statistics)[p->first] = base::Int64ToString(p->second); |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 | 1670 |
| 1657 QuotaManagerProxy::QuotaManagerProxy( | 1671 QuotaManagerProxy::QuotaManagerProxy( |
| 1658 QuotaManager* manager, base::SingleThreadTaskRunner* io_thread) | 1672 QuotaManager* manager, base::SingleThreadTaskRunner* io_thread) |
| 1659 : manager_(manager), io_thread_(io_thread) { | 1673 : manager_(manager), io_thread_(io_thread) { |
| 1660 } | 1674 } |
| 1661 | 1675 |
| 1662 QuotaManagerProxy::~QuotaManagerProxy() { | 1676 QuotaManagerProxy::~QuotaManagerProxy() { |
| 1663 } | 1677 } |
| 1664 | 1678 |
| 1665 } // namespace quota | 1679 } // namespace quota |
| OLD | NEW |