Chromium Code Reviews| 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 | |
| 1093 bool QuotaManager::IsTrackingHostUsage(StorageType type, | |
| 1094 QuotaClient::ID client_id) const { | |
| 1095 return GetUsageTracker(type)->GetClientTracker(client_id) != 0; | |
|
kinuko
2013/09/23 21:41:05
We're in chromium but not in blink, can we use NUL
SeRya
2013/09/24 09:55:15
Done.
| |
| 1096 } | |
| 1097 | |
| 1079 void QuotaManager::GetStatistics( | 1098 void QuotaManager::GetStatistics( |
| 1080 std::map<std::string, std::string>* statistics) { | 1099 std::map<std::string, std::string>* statistics) { |
| 1081 DCHECK(statistics); | 1100 DCHECK(statistics); |
| 1082 if (temporary_storage_evictor_) { | 1101 if (temporary_storage_evictor_) { |
| 1083 std::map<std::string, int64> stats; | 1102 std::map<std::string, int64> stats; |
| 1084 temporary_storage_evictor_->GetStatistics(&stats); | 1103 temporary_storage_evictor_->GetStatistics(&stats); |
| 1085 for (std::map<std::string, int64>::iterator p = stats.begin(); | 1104 for (std::map<std::string, int64>::iterator p = stats.begin(); |
| 1086 p != stats.end(); | 1105 p != stats.end(); |
| 1087 ++p) | 1106 ++p) |
| 1088 (*statistics)[p->first] = base::Int64ToString(p->second); | 1107 (*statistics)[p->first] = base::Int64ToString(p->second); |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1656 | 1675 |
| 1657 QuotaManagerProxy::QuotaManagerProxy( | 1676 QuotaManagerProxy::QuotaManagerProxy( |
| 1658 QuotaManager* manager, base::SingleThreadTaskRunner* io_thread) | 1677 QuotaManager* manager, base::SingleThreadTaskRunner* io_thread) |
| 1659 : manager_(manager), io_thread_(io_thread) { | 1678 : manager_(manager), io_thread_(io_thread) { |
| 1660 } | 1679 } |
| 1661 | 1680 |
| 1662 QuotaManagerProxy::~QuotaManagerProxy() { | 1681 QuotaManagerProxy::~QuotaManagerProxy() { |
| 1663 } | 1682 } |
| 1664 | 1683 |
| 1665 } // namespace quota | 1684 } // namespace quota |
| OLD | NEW |