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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_quota_quotaobject_h__
8 #define mozilla_dom_quota_quotaobject_h__
10 #include "mozilla/dom/quota/QuotaCommon.h"
12 #include "nsDataHashtable.h"
14 #include "PersistenceType.h"
22 friend class OriginInfo
;
23 friend class QuotaManager
;
25 class StoragePressureRunnable
;
32 const nsAString
& Path() const { return mPath
; }
34 bool MaybeUpdateSize(int64_t aSize
, bool aTruncate
);
36 bool IncreaseSize(int64_t aDelta
);
38 void DisableQuotaCheck();
40 void EnableQuotaCheck();
43 QuotaObject(OriginInfo
* aOriginInfo
, const nsAString
& aPath
, int64_t aSize
)
44 : mOriginInfo(aOriginInfo
),
47 mQuotaCheckDisabled(false),
49 MOZ_COUNT_CTOR(QuotaObject
);
52 ~QuotaObject() { MOZ_COUNT_DTOR(QuotaObject
); }
54 already_AddRefed
<QuotaObject
> LockedAddRef() {
55 AssertCurrentThreadOwnsQuotaMutex();
59 RefPtr
<QuotaObject
> result
= dont_AddRef(this);
60 return result
.forget();
63 bool LockedMaybeUpdateSize(int64_t aSize
, bool aTruncate
);
65 mozilla::ThreadSafeAutoRefCnt mRefCnt
;
67 OriginInfo
* mOriginInfo
;
71 bool mQuotaCheckDisabled
;
77 #endif // mozilla_dom_quota_quotaobject_h__