Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browsing_data_quota_helper_impl.h" | 5 #include "chrome/browser/browsing_data/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/barrier_closure.h" | 10 #include "base/barrier_closure.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 } | 142 } |
| 143 | 143 |
| 144 void BrowsingDataQuotaHelperImpl::OnGetHostsUsageComplete( | 144 void BrowsingDataQuotaHelperImpl::OnGetHostsUsageComplete( |
| 145 const FetchResultCallback& callback, | 145 const FetchResultCallback& callback, |
| 146 QuotaInfoMap* quota_info) { | 146 QuotaInfoMap* quota_info) { |
| 147 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 147 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 148 | 148 |
| 149 QuotaInfoArray result; | 149 QuotaInfoArray result; |
| 150 for (auto& pair : *quota_info) { | 150 for (auto& pair : *quota_info) { |
| 151 QuotaInfo& info = pair.second; | 151 QuotaInfo& info = pair.second; |
| 152 // TODO? This code skips quota entries without size and hides them this way | |
|
msramek
2017/01/09 12:54:43
I see. This is a bug somewhere in StoragePartition
dullweber
2017/01/09 16:05:45
I created https://bugs.chromium.org/p/chromium/iss
| |
| 153 // but this doesn't fix the issue that there are still quota entries left | |
| 154 // behind after deletion. | |
| 152 // Skip unused entries | 155 // Skip unused entries |
| 153 if (info.temporary_usage <= 0 && info.persistent_usage <= 0 && | 156 if (info.temporary_usage <= 0 && info.persistent_usage <= 0 && |
| 154 info.syncable_usage <= 0) | 157 info.syncable_usage <= 0) |
|
msramek
2017/01/09 12:54:43
style nit: I'd prefer keeping the empty line below
dullweber
2017/01/09 16:05:45
Done.
| |
| 155 continue; | 158 continue; |
| 156 | |
| 157 info.host = pair.first; | 159 info.host = pair.first; |
| 158 result.push_back(info); | 160 result.push_back(info); |
| 159 } | 161 } |
| 160 | 162 |
| 161 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 163 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 162 base::Bind(callback, result)); | 164 base::Bind(callback, result)); |
| 163 } | 165 } |
| 164 | 166 |
| 165 void BrowsingDataQuotaHelperImpl::RevokeHostQuotaOnIOThread( | 167 void BrowsingDataQuotaHelperImpl::RevokeHostQuotaOnIOThread( |
| 166 const std::string& host) { | 168 const std::string& host) { |
| 167 quota_manager_->SetPersistentHostQuota( | 169 quota_manager_->SetPersistentHostQuota( |
| 168 host, 0, base::Bind(&BrowsingDataQuotaHelperImpl::DidRevokeHostQuota, | 170 host, 0, base::Bind(&BrowsingDataQuotaHelperImpl::DidRevokeHostQuota, |
| 169 weak_factory_.GetWeakPtr())); | 171 weak_factory_.GetWeakPtr())); |
| 170 } | 172 } |
| 171 | 173 |
| 172 void BrowsingDataQuotaHelperImpl::DidRevokeHostQuota( | 174 void BrowsingDataQuotaHelperImpl::DidRevokeHostQuota( |
| 173 storage::QuotaStatusCode /*status*/, | 175 storage::QuotaStatusCode /*status*/, |
| 174 int64_t /*quota*/) {} | 176 int64_t /*quota*/) {} |
| OLD | NEW |