Skip to content

Commit

Permalink
Remove stl_util's deletion function use from storage/.
Browse files Browse the repository at this point in the history
BUG=555865

Review-Url: https://codereview.chromium.org/2478593002
Cr-Commit-Position: refs/heads/master@{#429803}
  • Loading branch information
avi authored and Commit bot committed Nov 4, 2016
1 parent c1d8671 commit 65426ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
15 changes: 6 additions & 9 deletions storage/browser/quota/usage_tracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <algorithm>

#include "base/bind.h"
#include "base/stl_util.h"
#include "base/memory/ptr_util.h"
#include "storage/browser/quota/client_usage_tracker.h"
#include "storage/browser/quota/storage_monitor.h"

Expand All @@ -34,21 +34,18 @@ UsageTracker::UsageTracker(const QuotaClientList& clients,
weak_factory_(this) {
for (auto* client : clients) {
if (client->DoesSupport(type)) {
client_tracker_map_[client->id()] =
new ClientUsageTracker(this, client, type, special_storage_policy,
storage_monitor_);
client_tracker_map_[client->id()] = base::MakeUnique<ClientUsageTracker>(
this, client, type, special_storage_policy, storage_monitor_);
}
}
}

UsageTracker::~UsageTracker() {
base::STLDeleteValues(&client_tracker_map_);
}
UsageTracker::~UsageTracker() {}

ClientUsageTracker* UsageTracker::GetClientTracker(QuotaClient::ID client_id) {
ClientTrackerMap::iterator found = client_tracker_map_.find(client_id);
auto found = client_tracker_map_.find(client_id);
if (found != client_tracker_map_.end())
return found->second;
return found->second.get();
return nullptr;
}

Expand Down
5 changes: 2 additions & 3 deletions storage/browser/quota/usage_tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ class STORAGE_EXPORT UsageTracker : public QuotaTaskObserver {
int64_t unlimited_usage;
};

typedef std::map<QuotaClient::ID, ClientUsageTracker*> ClientTrackerMap;

typedef CallbackQueue<UsageCallback, int64_t> UsageCallbackQueue;
typedef CallbackQueue<GlobalUsageCallback, int64_t, int64_t>
GlobalUsageCallbackQueue;
Expand All @@ -86,7 +84,8 @@ class STORAGE_EXPORT UsageTracker : public QuotaTaskObserver {
int64_t usage);

const StorageType type_;
ClientTrackerMap client_tracker_map_;
std::map<QuotaClient::ID, std::unique_ptr<ClientUsageTracker>>
client_tracker_map_;

UsageCallbackQueue global_limited_usage_callbacks_;
GlobalUsageCallbackQueue global_usage_callbacks_;
Expand Down

0 comments on commit 65426ee

Please sign in to comment.