OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/browsing_data_quota_helper_impl.h" | 5 #include "chrome/browser/browsing_data_quota_helper_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 FROM_HERE, | 136 FROM_HERE, |
137 NewRunnableMethod( | 137 NewRunnableMethod( |
138 this, | 138 this, |
139 &BrowsingDataQuotaHelperImpl::OnComplete)); | 139 &BrowsingDataQuotaHelperImpl::OnComplete)); |
140 return; | 140 return; |
141 } | 141 } |
142 | 142 |
143 is_fetching_ = false; | 143 is_fetching_ = false; |
144 | 144 |
145 QuotaInfoArray result; | 145 QuotaInfoArray result; |
146 result.reserve(quota_info_.size()); | |
147 | 146 |
148 for (std::map<std::string, QuotaInfo>::iterator itr = quota_info_.begin(); | 147 for (std::map<std::string, QuotaInfo>::iterator itr = quota_info_.begin(); |
149 itr != quota_info_.end(); | 148 itr != quota_info_.end(); |
150 ++itr) { | 149 ++itr) { |
151 QuotaInfo* info = &itr->second; | 150 QuotaInfo* info = &itr->second; |
152 // Skip unused entries | 151 // Skip unused entries |
153 if (info->temporary_usage <= 0 && | 152 if (info->temporary_usage <= 0 && |
154 info->persistent_usage <= 0) | 153 info->persistent_usage <= 0) |
155 continue; | 154 continue; |
156 | 155 |
157 info->host = itr->first; | 156 info->host = itr->first; |
158 result.push_back(*info); | 157 result.push_back(*info); |
159 } | 158 } |
160 | 159 |
161 callback_->Run(result); | 160 callback_->Run(result); |
162 callback_.reset(); | 161 callback_.reset(); |
163 } | 162 } |
OLD | NEW |