| 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 "storage/browser/quota/usage_tracker.h" | 5 #include "storage/browser/quota/usage_tracker.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 for (auto* client : clients) { | 35 for (auto* client : clients) { |
| 36 if (client->DoesSupport(type)) { | 36 if (client->DoesSupport(type)) { |
| 37 client_tracker_map_[client->id()] = | 37 client_tracker_map_[client->id()] = |
| 38 new ClientUsageTracker(this, client, type, special_storage_policy, | 38 new ClientUsageTracker(this, client, type, special_storage_policy, |
| 39 storage_monitor_); | 39 storage_monitor_); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 UsageTracker::~UsageTracker() { | 44 UsageTracker::~UsageTracker() { |
| 45 STLDeleteValues(&client_tracker_map_); | 45 base::STLDeleteValues(&client_tracker_map_); |
| 46 } | 46 } |
| 47 | 47 |
| 48 ClientUsageTracker* UsageTracker::GetClientTracker(QuotaClient::ID client_id) { | 48 ClientUsageTracker* UsageTracker::GetClientTracker(QuotaClient::ID client_id) { |
| 49 ClientTrackerMap::iterator found = client_tracker_map_.find(client_id); | 49 ClientTrackerMap::iterator found = client_tracker_map_.find(client_id); |
| 50 if (found != client_tracker_map_.end()) | 50 if (found != client_tracker_map_.end()) |
| 51 return found->second; | 51 return found->second; |
| 52 return nullptr; | 52 return nullptr; |
| 53 } | 53 } |
| 54 | 54 |
| 55 void UsageTracker::GetGlobalLimitedUsage(const UsageCallback& callback) { | 55 void UsageTracker::GetGlobalLimitedUsage(const UsageCallback& callback) { |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // Defend against confusing inputs from clients. | 216 // Defend against confusing inputs from clients. |
| 217 if (info->usage < 0) | 217 if (info->usage < 0) |
| 218 info->usage = 0; | 218 info->usage = 0; |
| 219 | 219 |
| 220 // All the clients have returned their usage data. Dispatch the | 220 // All the clients have returned their usage data. Dispatch the |
| 221 // pending callbacks. | 221 // pending callbacks. |
| 222 host_usage_callbacks_.Run(host, info->usage); | 222 host_usage_callbacks_.Run(host, info->usage); |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace storage | 225 } // namespace storage |
| OLD | NEW |