зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1206060 - Show pinning status at about:cache. r=michal
This commit is contained in:
Родитель
6ea6e3723a
Коммит
1e445509dc
|
@ -1857,7 +1857,8 @@ Predictor::Resetter::OnCacheStorageInfo(uint32_t entryCount, uint64_t consumptio
|
|||
NS_IMETHODIMP
|
||||
Predictor::Resetter::OnCacheEntryInfo(nsIURI *uri, const nsACString &idEnhance,
|
||||
int64_t dataSize, int32_t fetchCount,
|
||||
uint32_t lastModifiedTime, uint32_t expirationTime)
|
||||
uint32_t lastModifiedTime, uint32_t expirationTime,
|
||||
bool aPinned)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ public:
|
|||
bool IsReferenced() const;
|
||||
bool IsFileDoomed();
|
||||
bool IsDoomed() const { return mIsDoomed; }
|
||||
bool IsPinned() const { return mPinned; }
|
||||
|
||||
// Methods for entry management (eviction from memory),
|
||||
// called only on the management thread.
|
||||
|
|
|
@ -2382,7 +2382,7 @@ CacheFileIOManager::GetEntryInfo(const SHA1Sum::Hash *aHash,
|
|||
|
||||
// Call directly on the callback.
|
||||
aCallback->OnEntryInfo(uriSpec, enhanceId, dataSize, fetchCount,
|
||||
lastModified, expirationTime);
|
||||
lastModified, expirationTime, metadata->Pinned());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -311,7 +311,8 @@ private:
|
|||
|
||||
virtual void OnEntryInfo(const nsACString & aURISpec, const nsACString & aIdEnhance,
|
||||
int64_t aDataSize, int32_t aFetchCount,
|
||||
uint32_t aLastModifiedTime, uint32_t aExpirationTime)
|
||||
uint32_t aLastModifiedTime, uint32_t aExpirationTime,
|
||||
bool aPinned)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURISpec);
|
||||
|
@ -319,7 +320,7 @@ private:
|
|||
return;
|
||||
|
||||
mCallback->OnCacheEntryInfo(uri, aIdEnhance, aDataSize, aFetchCount,
|
||||
aLastModifiedTime, aExpirationTime);
|
||||
aLastModifiedTime, aExpirationTime, aPinned);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -379,7 +380,7 @@ private:
|
|||
|
||||
mWalker->mCallback->OnCacheEntryInfo(
|
||||
uri, mIdEnhance, mDataSize, mFetchCount,
|
||||
mLastModifiedTime, mExpirationTime);
|
||||
mLastModifiedTime, mExpirationTime, mPinned);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -391,6 +392,7 @@ private:
|
|||
int32_t mFetchCount;
|
||||
uint32_t mLastModifiedTime;
|
||||
uint32_t mExpirationTime;
|
||||
bool mPinned;
|
||||
};
|
||||
|
||||
NS_IMETHODIMP Run()
|
||||
|
@ -470,7 +472,8 @@ private:
|
|||
|
||||
virtual void OnEntryInfo(const nsACString & aURISpec, const nsACString & aIdEnhance,
|
||||
int64_t aDataSize, int32_t aFetchCount,
|
||||
uint32_t aLastModifiedTime, uint32_t aExpirationTime)
|
||||
uint32_t aLastModifiedTime, uint32_t aExpirationTime,
|
||||
bool aPinned)
|
||||
{
|
||||
// Called directly from CacheFileIOManager::GetEntryInfo.
|
||||
|
||||
|
@ -482,6 +485,7 @@ private:
|
|||
info->mFetchCount = aFetchCount;
|
||||
info->mLastModifiedTime = aLastModifiedTime;
|
||||
info->mExpirationTime = aExpirationTime;
|
||||
info->mPinned = aPinned;
|
||||
|
||||
NS_DispatchToMainThread(info);
|
||||
}
|
||||
|
@ -1924,7 +1928,8 @@ CacheStorageService::GetCacheEntryInfo(CacheEntry* aEntry,
|
|||
}
|
||||
|
||||
aCallback->OnEntryInfo(uriSpec, enhanceId, dataSize,
|
||||
fetchCount, lastModified, expirationTime);
|
||||
fetchCount, lastModified, expirationTime,
|
||||
aEntry->IsPinned());
|
||||
}
|
||||
|
||||
// Telementry collection
|
||||
|
|
|
@ -103,7 +103,8 @@ public:
|
|||
public:
|
||||
virtual void OnEntryInfo(const nsACString & aURISpec, const nsACString & aIdEnhance,
|
||||
int64_t aDataSize, int32_t aFetchCount,
|
||||
uint32_t aLastModifiedTime, uint32_t aExpirationTime) = 0;
|
||||
uint32_t aLastModifiedTime, uint32_t aExpirationTime,
|
||||
bool aPinned) = 0;
|
||||
};
|
||||
|
||||
// Invokes OnEntryInfo for the given aEntry, synchronously.
|
||||
|
|
|
@ -268,7 +268,7 @@ NS_IMETHODIMP _OldVisitCallbackWrapper::VisitEntry(const char * deviceID,
|
|||
|
||||
// Send them to the consumer.
|
||||
rv = mCB->OnCacheEntryInfo(
|
||||
uri, enhanceId, (int64_t)dataSize, fetchCount, lastModified, expirationTime);
|
||||
uri, enhanceId, (int64_t)dataSize, fetchCount, lastModified, expirationTime, false);
|
||||
|
||||
*_retval = NS_SUCCEEDED(rv);
|
||||
return NS_OK;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
interface nsIURI;
|
||||
interface nsIFile;
|
||||
|
||||
[scriptable, uuid(946bd799-9410-4945-9085-79c7fe019e83)]
|
||||
[scriptable, uuid(6cc7c253-93b6-482b-8e9d-1e04d8e9d655)]
|
||||
interface nsICacheStorageVisitor : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -24,7 +24,8 @@ interface nsICacheStorageVisitor : nsISupports
|
|||
in int64_t aDataSize,
|
||||
in long aFetchCount,
|
||||
in uint32_t aLastModifiedTime,
|
||||
in uint32_t aExpirationTime);
|
||||
in uint32_t aExpirationTime,
|
||||
in boolean aPinned);
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -346,7 +346,8 @@ nsAboutCache::OnCacheStorageInfo(uint32_t aEntryCount, uint64_t aConsumption,
|
|||
NS_IMETHODIMP
|
||||
nsAboutCache::OnCacheEntryInfo(nsIURI *aURI, const nsACString & aIdEnhance,
|
||||
int64_t aDataSize, int32_t aFetchCount,
|
||||
uint32_t aLastModified, uint32_t aExpirationTime)
|
||||
uint32_t aLastModified, uint32_t aExpirationTime,
|
||||
bool aPinned)
|
||||
{
|
||||
// We need mStream for this
|
||||
if (!mStream) {
|
||||
|
@ -362,6 +363,7 @@ nsAboutCache::OnCacheEntryInfo(nsIURI *aURI, const nsACString & aIdEnhance,
|
|||
" <col id=\"col-fetchCount\">\n"
|
||||
" <col id=\"col-lastModified\">\n"
|
||||
" <col id=\"col-expires\">\n"
|
||||
" <col id=\"col-pinned\">\n"
|
||||
" </colgroup>\n"
|
||||
" <thead>\n"
|
||||
" <tr>\n"
|
||||
|
@ -370,6 +372,7 @@ nsAboutCache::OnCacheEntryInfo(nsIURI *aURI, const nsACString & aIdEnhance,
|
|||
" <th>Fetch count</th>\n"
|
||||
" <th>Last Modifed</th>\n"
|
||||
" <th>Expires</th>\n"
|
||||
" <th>Pinning</th>\n"
|
||||
" </tr>\n"
|
||||
" </thead>\n");
|
||||
mEntriesHeaderAdded = true;
|
||||
|
@ -446,6 +449,15 @@ nsAboutCache::OnCacheEntryInfo(nsIURI *aURI, const nsACString & aIdEnhance,
|
|||
}
|
||||
mBuffer.AppendLiteral("</td>\n");
|
||||
|
||||
// Pinning
|
||||
mBuffer.AppendLiteral(" <td>");
|
||||
if (aPinned) {
|
||||
mBuffer.Append(NS_LITERAL_CSTRING("Pinned"));
|
||||
} else {
|
||||
mBuffer.Append(NS_LITERAL_CSTRING(" "));
|
||||
}
|
||||
mBuffer.AppendLiteral("</td>\n");
|
||||
|
||||
// Entry is done...
|
||||
mBuffer.AppendLiteral(" </tr>\n");
|
||||
|
||||
|
|
|
@ -42,6 +42,10 @@ td {
|
|||
width: 13%;
|
||||
}
|
||||
|
||||
#col-pinned {
|
||||
width: 5em;
|
||||
}
|
||||
|
||||
#entries > tbody > tr:nth-child(odd) {
|
||||
background-color: rgba(0, 0, 0, .03);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче