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
3 // found in the LICENSE file.
5 #include "chrome/browser/browsing_data/browsing_data_quota_helper.h"
7 #include "base/location.h"
8 #include "base/single_thread_task_runner.h"
10 BrowsingDataQuotaHelper::QuotaInfo::QuotaInfo()
15 BrowsingDataQuotaHelper::QuotaInfo::QuotaInfo(const std::string
& host
)
21 BrowsingDataQuotaHelper::QuotaInfo::QuotaInfo(const std::string
& host
,
22 int64 temporary_usage
,
23 int64 persistent_usage
,
26 temporary_usage(temporary_usage
),
27 persistent_usage(persistent_usage
),
28 syncable_usage(syncable_usage
) {}
30 BrowsingDataQuotaHelper::QuotaInfo::~QuotaInfo() {}
33 void BrowsingDataQuotaHelperDeleter::Destruct(
34 const BrowsingDataQuotaHelper
* helper
) {
35 helper
->io_thread_
->DeleteSoon(FROM_HERE
, helper
);
38 BrowsingDataQuotaHelper::BrowsingDataQuotaHelper(
39 base::SingleThreadTaskRunner
* io_thread
)
40 : io_thread_(io_thread
) {
43 BrowsingDataQuotaHelper::~BrowsingDataQuotaHelper() {
46 bool BrowsingDataQuotaHelper::QuotaInfo::operator <(
47 const BrowsingDataQuotaHelper::QuotaInfo
& rhs
) const {
48 if (this->host
!= rhs
.host
)
49 return this->host
< rhs
.host
;
50 if (this->temporary_usage
!= rhs
.temporary_usage
)
51 return this->temporary_usage
< rhs
.temporary_usage
;
52 if (this->syncable_usage
!= rhs
.syncable_usage
)
53 return this->syncable_usage
< rhs
.syncable_usage
;
54 return this->persistent_usage
< rhs
.persistent_usage
;
57 bool BrowsingDataQuotaHelper::QuotaInfo::operator ==(
58 const BrowsingDataQuotaHelper::QuotaInfo
& rhs
) const {
59 return this->host
== rhs
.host
&&
60 this->temporary_usage
== rhs
.temporary_usage
&&
61 this->persistent_usage
== rhs
.persistent_usage
&&
62 this->syncable_usage
== rhs
.syncable_usage
;