Bug 1431029 - Expose timestamp for quota managed storage. r=asuth

MozReview-Commit-ID: 7MNd2m2Jp46

--HG--
extra : rebase_source : 4a17e0b6b38073fea7b4b3d3b4483d4c495b3950
This commit is contained in:
Johann Hofmann 2018-02-20 14:54:17 +01:00
Родитель 98ca15a50f
Коммит 23a0a82554
6 изменённых файлов: 22 добавлений и 3 удалений

Просмотреть файл

@ -163,7 +163,8 @@ QuotaUsageRequestChild::HandleResponse(const nsTArray<OriginUsage>& aResponse)
RefPtr<UsageResult> usageResult = new UsageResult(originUsage.origin(),
originUsage.persisted(),
originUsage.usage());
originUsage.usage(),
originUsage.lastAccessed());
usageResults.AppendElement(usageResult.forget());
}

Просмотреть файл

@ -6979,6 +6979,8 @@ GetUsageOp::TraverseRepository(QuotaManager* aQuotaManager,
originUsage->persisted() = persisted;
}
originUsage->lastAccessed() = timestamp;
UsageInfo usageInfo;
rv = GetUsageForOrigin(aQuotaManager,
aPersistenceType,

Просмотреть файл

@ -13,6 +13,7 @@ struct OriginUsage
nsCString origin;
bool persisted;
uint64_t usage;
uint64_t lastAccessed;
};
struct AllUsageResponse

Просмотреть файл

@ -12,10 +12,12 @@ namespace quota {
UsageResult::UsageResult(const nsACString& aOrigin,
bool aPersisted,
uint64_t aUsage)
uint64_t aUsage,
uint64_t aLastAccessed)
: mOrigin(aOrigin)
, mUsage(aUsage)
, mPersisted(aPersisted)
, mLastAccessed(aLastAccessed)
{
}
@ -47,6 +49,15 @@ UsageResult::GetUsage(uint64_t* aUsage)
return NS_OK;
}
NS_IMETHODIMP
UsageResult::GetLastAccessed(uint64_t* aLastAccessed)
{
MOZ_ASSERT(aLastAccessed);
*aLastAccessed = mLastAccessed;
return NS_OK;
}
OriginUsageResult::OriginUsageResult(uint64_t aUsage,
uint64_t aFileUsage,
uint64_t aLimit)

Просмотреть файл

@ -19,11 +19,13 @@ class UsageResult
nsCString mOrigin;
uint64_t mUsage;
bool mPersisted;
uint64_t mLastAccessed;
public:
UsageResult(const nsACString& aOrigin,
bool aPersisted,
uint64_t aUsage);
uint64_t aUsage,
uint64_t aLastAccessed);
private:
virtual ~UsageResult()

Просмотреть файл

@ -14,6 +14,8 @@ interface nsIQuotaUsageResult : nsISupports
readonly attribute boolean persisted;
readonly attribute unsigned long long usage;
readonly attribute unsigned long long lastAccessed;
};
[scriptable, function, uuid(96df03d2-116a-493f-bb0b-118c212a6b32)]