2013-03-26 04:13:17 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-05-03 12:32:37 -07:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-03-26 04:13:17 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_quota_quotaobject_h__
|
|
|
|
#define mozilla_dom_quota_quotaobject_h__
|
|
|
|
|
|
|
|
#include "mozilla/dom/quota/QuotaCommon.h"
|
|
|
|
|
|
|
|
#include "nsDataHashtable.h"
|
|
|
|
|
2013-09-10 21:18:36 -07:00
|
|
|
#include "PersistenceType.h"
|
|
|
|
|
2013-03-26 04:13:17 -07:00
|
|
|
BEGIN_QUOTA_NAMESPACE
|
|
|
|
|
|
|
|
class OriginInfo;
|
|
|
|
class QuotaManager;
|
|
|
|
|
|
|
|
class QuotaObject
|
|
|
|
{
|
|
|
|
friend class OriginInfo;
|
|
|
|
friend class QuotaManager;
|
|
|
|
|
|
|
|
public:
|
|
|
|
void
|
|
|
|
AddRef();
|
|
|
|
|
|
|
|
void
|
|
|
|
Release();
|
|
|
|
|
|
|
|
bool
|
2015-02-16 09:48:14 -08:00
|
|
|
MaybeUpdateSize(int64_t aSize, bool aTruncate);
|
2013-03-26 04:13:17 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
QuotaObject(OriginInfo* aOriginInfo, const nsAString& aPath, int64_t aSize)
|
|
|
|
: mOriginInfo(aOriginInfo), mPath(aPath), mSize(aSize)
|
2013-09-10 21:18:36 -07:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(QuotaObject);
|
|
|
|
}
|
2013-03-26 04:13:17 -07:00
|
|
|
|
2013-09-10 21:18:36 -07:00
|
|
|
~QuotaObject()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(QuotaObject);
|
|
|
|
}
|
2013-03-26 04:13:17 -07:00
|
|
|
|
2014-01-13 10:27:19 -08:00
|
|
|
already_AddRefed<QuotaObject>
|
|
|
|
LockedAddRef()
|
|
|
|
{
|
|
|
|
AssertCurrentThreadOwnsQuotaMutex();
|
|
|
|
|
|
|
|
++mRefCnt;
|
|
|
|
|
2015-10-17 22:24:48 -07:00
|
|
|
RefPtr<QuotaObject> result = dont_AddRef(this);
|
2014-01-13 10:27:19 -08:00
|
|
|
return result.forget();
|
|
|
|
}
|
|
|
|
|
2013-07-18 19:21:20 -07:00
|
|
|
mozilla::ThreadSafeAutoRefCnt mRefCnt;
|
2013-03-26 04:13:17 -07:00
|
|
|
|
|
|
|
OriginInfo* mOriginInfo;
|
|
|
|
nsString mPath;
|
|
|
|
int64_t mSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
END_QUOTA_NAMESPACE
|
|
|
|
|
|
|
|
#endif // mozilla_dom_quota_quotaobject_h__
|