1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "QuotaResults.h"
10 #include "mozilla/Assertions.h"
11 #include "mozilla/MacroForEach.h"
14 namespace mozilla::dom::quota
{
16 UsageResult::UsageResult(const nsACString
& aOrigin
, bool aPersisted
,
17 uint64_t aUsage
, uint64_t aLastAccessed
)
20 mPersisted(aPersisted
),
21 mLastAccessed(aLastAccessed
) {}
23 NS_IMPL_ISUPPORTS(UsageResult
, nsIQuotaUsageResult
)
26 UsageResult::GetOrigin(nsACString
& aOrigin
) {
32 UsageResult::GetPersisted(bool* aPersisted
) {
33 MOZ_ASSERT(aPersisted
);
35 *aPersisted
= mPersisted
;
40 UsageResult::GetUsage(uint64_t* aUsage
) {
48 UsageResult::GetLastAccessed(uint64_t* aLastAccessed
) {
49 MOZ_ASSERT(aLastAccessed
);
51 *aLastAccessed
= mLastAccessed
;
55 OriginUsageResult::OriginUsageResult(uint64_t aUsage
, uint64_t aFileUsage
)
56 : mUsage(aUsage
), mFileUsage(aFileUsage
) {}
58 NS_IMPL_ISUPPORTS(OriginUsageResult
, nsIQuotaOriginUsageResult
)
61 OriginUsageResult::GetUsage(uint64_t* aUsage
) {
69 OriginUsageResult::GetFileUsage(uint64_t* aFileUsage
) {
70 MOZ_ASSERT(aFileUsage
);
72 *aFileUsage
= mFileUsage
;
76 EstimateResult::EstimateResult(uint64_t aUsage
, uint64_t aLimit
)
77 : mUsage(aUsage
), mLimit(aLimit
) {}
79 NS_IMPL_ISUPPORTS(EstimateResult
, nsIQuotaEstimateResult
)
82 EstimateResult::GetUsage(uint64_t* aUsage
) {
90 EstimateResult::GetLimit(uint64_t* aLimit
) {
97 } // namespace mozilla::dom::quota