| 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 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 UsageTracker::UsageTracker(const QuotaClientList& clients, | 28 UsageTracker::UsageTracker(const QuotaClientList& clients, |
| 29 StorageType type, | 29 StorageType type, |
| 30 SpecialStoragePolicy* special_storage_policy, | 30 SpecialStoragePolicy* special_storage_policy, |
| 31 StorageMonitor* storage_monitor) | 31 StorageMonitor* storage_monitor) |
| 32 : type_(type), | 32 : type_(type), |
| 33 storage_monitor_(storage_monitor), | 33 storage_monitor_(storage_monitor), |
| 34 weak_factory_(this) { | 34 weak_factory_(this) { |
| 35 for (const 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 STLDeleteValues(&client_tracker_map_); |
| (...skipping 170 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 |