forked from mirrors/gecko-dev
Bug 1768679 - Expose cache fetch count as uint32_t r=dragana,necko-reviewers
The value is stored as uint32_t, and there doesn't seem to be a need to convert it to int. Differential Revision: https://phabricator.services.mozilla.com/D147888
This commit is contained in:
parent
197ca9977c
commit
f9c451035e
15 changed files with 25 additions and 26 deletions
|
|
@ -2043,7 +2043,7 @@ bool ScriptLoader::ShouldCacheBytecode(ScriptLoadRequest* aRequest) {
|
|||
bool hasSourceLengthMin = false;
|
||||
bool hasFetchCountMin = false;
|
||||
size_t sourceLengthMin = 100;
|
||||
int32_t fetchCountMin = 4;
|
||||
uint32_t fetchCountMin = 4;
|
||||
|
||||
LOG(("ScriptLoadRequest (%p): Bytecode-cache: strategy = %d.", aRequest,
|
||||
strategy));
|
||||
|
|
@ -2092,7 +2092,7 @@ bool ScriptLoader::ShouldCacheBytecode(ScriptLoadRequest* aRequest) {
|
|||
// bytecode-cache optimization, such that we do not waste time on entry which
|
||||
// are going to be dropped soon.
|
||||
if (hasFetchCountMin) {
|
||||
int32_t fetchCount = 0;
|
||||
uint32_t fetchCount = 0;
|
||||
if (NS_FAILED(aRequest->mCacheInfo->GetCacheTokenFetchCount(&fetchCount))) {
|
||||
LOG(("ScriptLoadRequest (%p): Bytecode-cache: Cannot get fetchCount.",
|
||||
aRequest));
|
||||
|
|
|
|||
|
|
@ -707,7 +707,7 @@ bool Predictor::PredictForPageload(nsICacheEntry* entry, nsIURI* targetURI,
|
|||
int32_t globalDegradation = CalculateGlobalDegradation(lastLoad);
|
||||
PREDICTOR_LOG((" globalDegradation = %d", globalDegradation));
|
||||
|
||||
int32_t loadCount;
|
||||
uint32_t loadCount;
|
||||
rv = entry->GetFetchCount(&loadCount);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
|
|
@ -1542,7 +1542,7 @@ void Predictor::LearnForSubresource(nsICacheEntry* entry, nsIURI* targetURI) {
|
|||
nsresult rv = entry->GetLastFetched(&lastLoad);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
int32_t loadCount;
|
||||
uint32_t loadCount;
|
||||
rv = entry->GetFetchCount(&loadCount);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
|
|
@ -1596,7 +1596,7 @@ void Predictor::LearnForSubresource(nsICacheEntry* entry, nsIURI* targetURI) {
|
|||
flags = 0;
|
||||
} else {
|
||||
PREDICTOR_LOG((" existing resource"));
|
||||
hitCount = std::min(hitCount + 1, static_cast<uint32_t>(loadCount));
|
||||
hitCount = std::min(hitCount + 1, loadCount);
|
||||
}
|
||||
|
||||
// Update the rolling load count to mark this sub-resource as seen on the
|
||||
|
|
@ -1818,7 +1818,7 @@ Predictor::Resetter::OnCacheStorageInfo(uint32_t entryCount,
|
|||
|
||||
NS_IMETHODIMP
|
||||
Predictor::Resetter::OnCacheEntryInfo(nsIURI* uri, const nsACString& idEnhance,
|
||||
int64_t dataSize, int32_t fetchCount,
|
||||
int64_t dataSize, uint32_t fetchCount,
|
||||
uint32_t lastModifiedTime,
|
||||
uint32_t expirationTime, bool aPinned,
|
||||
nsILoadContextInfo* aInfo) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ interface nsICacheInfoChannel : nsISupports
|
|||
* @throws NS_ERROR_NOT_AVAILABLE if the cache entry or the alternate data
|
||||
* cache entry cannot be read.
|
||||
*/
|
||||
readonly attribute int32_t cacheTokenFetchCount;
|
||||
readonly attribute uint32_t cacheTokenFetchCount;
|
||||
|
||||
/**
|
||||
* Get expiration time from cache token. This attribute is equivalent to
|
||||
|
|
|
|||
|
|
@ -1045,10 +1045,10 @@ nsresult CacheEntry::GetCacheEntryId(uint64_t* aCacheEntryId) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult CacheEntry::GetFetchCount(int32_t* aFetchCount) {
|
||||
nsresult CacheEntry::GetFetchCount(uint32_t* aFetchCount) {
|
||||
NS_ENSURE_SUCCESS(mFileStatus, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
return mFile->GetFetchCount(reinterpret_cast<uint32_t*>(aFetchCount));
|
||||
return mFile->GetFetchCount(aFetchCount);
|
||||
}
|
||||
|
||||
nsresult CacheEntry::GetLastFetched(uint32_t* aLastFetched) {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class CacheEntry final : public nsIRunnable, public CacheFileListener {
|
|||
nsresult GetKey(nsACString& aKey);
|
||||
nsresult GetCacheEntryId(uint64_t* aCacheEntryId);
|
||||
nsresult GetPersistent(bool* aPersistToDisk);
|
||||
nsresult GetFetchCount(int32_t* aFetchCount);
|
||||
nsresult GetFetchCount(uint32_t* aFetchCount);
|
||||
nsresult GetLastFetched(uint32_t* aLastFetched);
|
||||
nsresult GetLastModified(uint32_t* aLastModified);
|
||||
nsresult GetExpirationTime(uint32_t* aExpirationTime);
|
||||
|
|
@ -442,7 +442,7 @@ class CacheEntryHandle final : public nsICacheEntry {
|
|||
NS_IMETHOD GetPersistent(bool* aPersistent) override {
|
||||
return mEntry->GetPersistent(aPersistent);
|
||||
}
|
||||
NS_IMETHOD GetFetchCount(int32_t* aFetchCount) override {
|
||||
NS_IMETHOD GetFetchCount(uint32_t* aFetchCount) override {
|
||||
return mEntry->GetFetchCount(aFetchCount);
|
||||
}
|
||||
NS_IMETHOD GetLastFetched(uint32_t* aLastFetched) override {
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ class WalkMemoryCacheRunnable : public WalkCacheRunnable {
|
|||
|
||||
virtual void OnEntryInfo(const nsACString& aURISpec,
|
||||
const nsACString& aIdEnhance, int64_t aDataSize,
|
||||
int32_t aFetchCount, uint32_t aLastModifiedTime,
|
||||
uint32_t aFetchCount, uint32_t aLastModifiedTime,
|
||||
uint32_t aExpirationTime, bool aPinned,
|
||||
nsILoadContextInfo* aInfo) override {
|
||||
nsresult rv;
|
||||
|
|
@ -396,7 +396,7 @@ class WalkDiskCacheRunnable : public WalkCacheRunnable {
|
|||
nsCString mURISpec;
|
||||
nsCString mIdEnhance;
|
||||
int64_t mDataSize{0};
|
||||
int32_t mFetchCount{0};
|
||||
uint32_t mFetchCount{0};
|
||||
uint32_t mLastModifiedTime{0};
|
||||
uint32_t mExpirationTime{0};
|
||||
bool mPinned{false};
|
||||
|
|
@ -480,7 +480,7 @@ class WalkDiskCacheRunnable : public WalkCacheRunnable {
|
|||
|
||||
virtual void OnEntryInfo(const nsACString& aURISpec,
|
||||
const nsACString& aIdEnhance, int64_t aDataSize,
|
||||
int32_t aFetchCount, uint32_t aLastModifiedTime,
|
||||
uint32_t aFetchCount, uint32_t aLastModifiedTime,
|
||||
uint32_t aExpirationTime, bool aPinned,
|
||||
nsILoadContextInfo* aInfo) override {
|
||||
// Called directly from CacheFileIOManager::GetEntryInfo.
|
||||
|
|
@ -2084,7 +2084,7 @@ void CacheStorageService::GetCacheEntryInfo(CacheEntry* aEntry,
|
|||
if (NS_FAILED(aEntry->GetStorageDataSize(&dataSize))) {
|
||||
dataSize = 0;
|
||||
}
|
||||
int32_t fetchCount;
|
||||
uint32_t fetchCount;
|
||||
if (NS_FAILED(aEntry->GetFetchCount(&fetchCount))) {
|
||||
fetchCount = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ class CacheStorageService final : public nsICacheStorageService,
|
|||
public:
|
||||
virtual void OnEntryInfo(const nsACString& aURISpec,
|
||||
const nsACString& aIdEnhance, int64_t aDataSize,
|
||||
int32_t aFetchCount, uint32_t aLastModifiedTime,
|
||||
uint32_t aFetchCount, uint32_t aLastModifiedTime,
|
||||
uint32_t aExpirationTime, bool aPinned,
|
||||
nsILoadContextInfo* aInfo) = 0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ interface nsICacheEntry : nsISupports
|
|||
/**
|
||||
* Get the number of times the cache entry has been opened.
|
||||
*/
|
||||
readonly attribute long fetchCount;
|
||||
readonly attribute uint32_t fetchCount;
|
||||
|
||||
/**
|
||||
* Get the last time the cache entry was opened (in seconds since the Epoch).
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ interface nsICacheStorageVisitor : nsISupports
|
|||
void onCacheEntryInfo(in nsIURI aURI,
|
||||
in ACString aIdEnhance,
|
||||
in int64_t aDataSize,
|
||||
in long aFetchCount,
|
||||
in uint32_t aFetchCount,
|
||||
in uint32_t aLastModifiedTime,
|
||||
in uint32_t aExpirationTime,
|
||||
in boolean aPinned,
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ nsAboutCache::Channel::OnCacheStorageInfo(uint32_t aEntryCount,
|
|||
NS_IMETHODIMP
|
||||
nsAboutCache::Channel::OnCacheEntryInfo(nsIURI* aURI,
|
||||
const nsACString& aIdEnhance,
|
||||
int64_t aDataSize, int32_t aFetchCount,
|
||||
int64_t aDataSize, uint32_t aFetchCount,
|
||||
uint32_t aLastModified,
|
||||
uint32_t aExpirationTime, bool aPinned,
|
||||
nsILoadContextInfo* aInfo) {
|
||||
|
|
|
|||
|
|
@ -359,13 +359,12 @@ nsresult nsAboutCacheEntry::Channel::WriteCacheEntryDescription(
|
|||
// temp vars for reporting
|
||||
char timeBuf[255];
|
||||
uint32_t u = 0;
|
||||
int32_t i = 0;
|
||||
nsAutoCString s;
|
||||
|
||||
// Fetch Count
|
||||
s.Truncate();
|
||||
entry->GetFetchCount(&i);
|
||||
s.AppendInt(i);
|
||||
entry->GetFetchCount(&u);
|
||||
s.AppendInt(u);
|
||||
APPEND_ROW("fetch count", s);
|
||||
|
||||
// Last Fetched
|
||||
|
|
|
|||
|
|
@ -2330,7 +2330,7 @@ HttpChannelChild::GetIsAuthChannel(bool* aIsAuthChannel) { DROP_DEAD(); }
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpChannelChild::GetCacheTokenFetchCount(int32_t* _retval) {
|
||||
HttpChannelChild::GetCacheTokenFetchCount(uint32_t* _retval) {
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ struct HttpChannelOnStartRequestArgs
|
|||
bool isRacing;
|
||||
bool cacheEntryAvailable;
|
||||
uint64_t cacheEntryId;
|
||||
int32_t cacheFetchCount;
|
||||
uint32_t cacheFetchCount;
|
||||
uint32_t cacheExpirationTime;
|
||||
nsCString securityInfoSerialization;
|
||||
NetAddr selfAddr;
|
||||
|
|
|
|||
|
|
@ -1190,7 +1190,7 @@ InterceptedHttpChannel::GetCacheEntryId(uint64_t* aCacheEntryId) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
InterceptedHttpChannel::GetCacheTokenFetchCount(int32_t* _retval) {
|
||||
InterceptedHttpChannel::GetCacheTokenFetchCount(uint32_t* _retval) {
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
if (mSynthesizedCacheInfo) {
|
||||
|
|
|
|||
|
|
@ -7983,7 +7983,7 @@ nsHttpChannel::GetCacheEntryId(uint64_t* aCacheEntryId) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetCacheTokenFetchCount(int32_t* _retval) {
|
||||
nsHttpChannel::GetCacheTokenFetchCount(uint32_t* _retval) {
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
nsCOMPtr<nsICacheEntry> cacheEntry =
|
||||
mCacheEntry ? mCacheEntry : mAltDataCacheEntry;
|
||||
|
|
|
|||
Loading…
Reference in a new issue