mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1203427 (part 1) - Add nsExpirationTracker::mName. r=froydnj.
There are many sub-classes of nsExpirationTracker. In order to distinguish them nicely in the logging of timer firings, it's necessary to manually name each one. (This wouldn't be necessary if there was a way to stringify template parameters, but there isn't.)
This commit is contained in:
parent
29b0b79580
commit
cae6e9971a
@ -38,7 +38,7 @@ class HistoryTracker final : public HistoryTrackerBase
|
||||
{
|
||||
public:
|
||||
explicit HistoryTracker(uint32_t aTimeout)
|
||||
: HistoryTrackerBase(1000 * aTimeout / 2)
|
||||
: HistoryTrackerBase(1000 * aTimeout / 2, "HistoryTracker")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1429,7 +1429,8 @@ nsDOMStyleSheetSetList::EnsureFresh()
|
||||
|
||||
// ==================================================================
|
||||
nsIDocument::SelectorCache::SelectorCache()
|
||||
: nsExpirationTracker<SelectorCacheKey, 4>(1000) { }
|
||||
: nsExpirationTracker<SelectorCacheKey, 4>(1000, "nsIDocument::SelectorCache")
|
||||
{ }
|
||||
|
||||
// CacheList takes ownership of aSelectorList.
|
||||
void nsIDocument::SelectorCache::CacheList(const nsAString& aSelector,
|
||||
|
@ -216,7 +216,7 @@ public:
|
||||
};
|
||||
|
||||
ImageCache::ImageCache()
|
||||
: nsExpirationTracker<ImageCacheEntryData,4>(GENERATION_MS)
|
||||
: nsExpirationTracker<ImageCacheEntryData,4>(GENERATION_MS, "ImageCache")
|
||||
, mTotal(0)
|
||||
{
|
||||
if (!sPrefsInitialized) {
|
||||
|
@ -442,7 +442,7 @@ gfxShmSharedReadLock::GetReadCount() {
|
||||
class TileExpiry final : public nsExpirationTracker<TileClient, 3>
|
||||
{
|
||||
public:
|
||||
TileExpiry() : nsExpirationTracker<TileClient, 3>(1000) {}
|
||||
TileExpiry() : nsExpirationTracker<TileClient, 3>(1000, "TileExpiry") {}
|
||||
|
||||
static void AddTile(TileClient* aTile)
|
||||
{
|
||||
|
@ -36,7 +36,9 @@ class FrameTextRunCache final : public nsExpirationTracker<gfxTextRun,3> {
|
||||
public:
|
||||
enum { TIMEOUT_SECONDS = 10 };
|
||||
FrameTextRunCache()
|
||||
: nsExpirationTracker<gfxTextRun,3>(TIMEOUT_SECONDS*1000) {}
|
||||
: nsExpirationTracker<gfxTextRun,3>(TIMEOUT_SECONDS * 1000,
|
||||
"FrameTextRunCache")
|
||||
{}
|
||||
~FrameTextRunCache() {
|
||||
AgeAllGenerations();
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ class BlurCache final : public nsExpirationTracker<BlurCacheData,4>
|
||||
{
|
||||
public:
|
||||
BlurCache()
|
||||
: nsExpirationTracker<BlurCacheData, 4>(GENERATION_MS)
|
||||
: nsExpirationTracker<BlurCacheData, 4>(GENERATION_MS, "BlurCache")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,8 @@ gfxFontCache::Shutdown()
|
||||
}
|
||||
|
||||
gfxFontCache::gfxFontCache()
|
||||
: nsExpirationTracker<gfxFont,3>(FONT_TIMEOUT_SECONDS * 1000)
|
||||
: nsExpirationTracker<gfxFont,3>(FONT_TIMEOUT_SECONDS * 1000,
|
||||
"gfxFontCache")
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obs = GetObserverService();
|
||||
if (obs) {
|
||||
|
@ -122,7 +122,8 @@ class GradientCache final : public nsExpirationTracker<GradientCacheData,4>
|
||||
{
|
||||
public:
|
||||
GradientCache()
|
||||
: nsExpirationTracker<GradientCacheData, 4>(MAX_GENERATION_MS)
|
||||
: nsExpirationTracker<GradientCacheData,4>(MAX_GENERATION_MS,
|
||||
"GradientCache")
|
||||
{
|
||||
srand(time(nullptr));
|
||||
mTimerPeriod = rand() % MAX_GENERATION_MS + 1;
|
||||
|
@ -941,7 +941,8 @@ private:
|
||||
struct SurfaceTracker : public nsExpirationTracker<CachedSurface, 2>
|
||||
{
|
||||
explicit SurfaceTracker(uint32_t aSurfaceCacheExpirationTimeMS)
|
||||
: nsExpirationTracker<CachedSurface, 2>(aSurfaceCacheExpirationTimeMS)
|
||||
: nsExpirationTracker<CachedSurface, 2>(aSurfaceCacheExpirationTimeMS,
|
||||
"SurfaceTracker")
|
||||
{ }
|
||||
|
||||
protected:
|
||||
|
@ -1069,7 +1069,8 @@ protected:
|
||||
};
|
||||
|
||||
imgCacheExpirationTracker::imgCacheExpirationTracker()
|
||||
: nsExpirationTracker<imgCacheEntry, 3>(TIMEOUT_SECONDS * 1000)
|
||||
: nsExpirationTracker<imgCacheEntry, 3>(TIMEOUT_SECONDS * 1000,
|
||||
"imgCacheExpirationTracker")
|
||||
{ }
|
||||
|
||||
void
|
||||
|
@ -100,7 +100,9 @@ public:
|
||||
// 75-100ms is a good timeout period. We use 4 generations of 25ms each.
|
||||
enum { GENERATION_MS = 100 };
|
||||
LayerActivityTracker()
|
||||
: nsExpirationTracker<LayerActivity,4>(GENERATION_MS) {}
|
||||
: nsExpirationTracker<LayerActivity,4>(GENERATION_MS,
|
||||
"LayerActivityTracker")
|
||||
{}
|
||||
~LayerActivityTracker() {
|
||||
AgeAllGenerations();
|
||||
}
|
||||
|
@ -1782,7 +1782,9 @@ public:
|
||||
// That's 4 generations of 1s each.
|
||||
enum { TIMEOUT_MS = 1000 };
|
||||
ScrollFrameActivityTracker()
|
||||
: nsExpirationTracker<ScrollFrameHelper,4>(TIMEOUT_MS) {}
|
||||
: nsExpirationTracker<ScrollFrameHelper,4>(TIMEOUT_MS,
|
||||
"ScrollFrameActivityTracker")
|
||||
{}
|
||||
~ScrollFrameActivityTracker() {
|
||||
AgeAllGenerations();
|
||||
}
|
||||
|
@ -556,7 +556,9 @@ class FrameTextRunCache final : public nsExpirationTracker<gfxTextRun,3> {
|
||||
public:
|
||||
enum { TIMEOUT_SECONDS = 10 };
|
||||
FrameTextRunCache()
|
||||
: nsExpirationTracker<gfxTextRun,3>(TIMEOUT_SECONDS*1000) {}
|
||||
: nsExpirationTracker<gfxTextRun,3>(TIMEOUT_SECONDS * 1000,
|
||||
"FrameTextRunCache")
|
||||
{}
|
||||
~FrameTextRunCache() {
|
||||
AgeAllGenerations();
|
||||
}
|
||||
|
@ -71,7 +71,8 @@ private:
|
||||
{
|
||||
public:
|
||||
explicit ExpirationTracker(RuleProcessorCache* aCache)
|
||||
: nsExpirationTracker<nsCSSRuleProcessor,3>(10000)
|
||||
: nsExpirationTracker<nsCSSRuleProcessor,3>(
|
||||
10000, "RuleProcessorCache::ExpirationTracker")
|
||||
, mCache(aCache) {}
|
||||
|
||||
void RemoveObjectIfTracked(nsCSSRuleProcessor* aRuleProcessor);
|
||||
|
@ -82,10 +82,11 @@ public:
|
||||
* period is zero, then we don't use a timer and rely on someone calling
|
||||
* AgeOneGeneration explicitly.
|
||||
*/
|
||||
explicit nsExpirationTracker(uint32_t aTimerPeriod)
|
||||
explicit nsExpirationTracker(uint32_t aTimerPeriod, const char* aName)
|
||||
: mTimerPeriod(aTimerPeriod)
|
||||
, mNewestGeneration(0)
|
||||
, mInAgeOneGeneration(false)
|
||||
, mName(aName)
|
||||
{
|
||||
static_assert(K >= 2 && K <= nsExpirationState::NOT_TRACKED,
|
||||
"Unsupported number of generations (must be 2 <= K <= 15)");
|
||||
@ -308,6 +309,7 @@ private:
|
||||
uint32_t mTimerPeriod;
|
||||
uint32_t mNewestGeneration;
|
||||
bool mInAgeOneGeneration;
|
||||
const char* const mName; // Used for timer firing profiling.
|
||||
|
||||
/**
|
||||
* Whenever "memory-pressure" is observed, it calls AgeAllGenerations()
|
||||
|
@ -43,7 +43,7 @@ static uint32_t slackMS = 30; // allow this much error
|
||||
|
||||
template <uint32_t K> class Tracker : public nsExpirationTracker<Object,K> {
|
||||
public:
|
||||
Tracker() : nsExpirationTracker<Object,K>(periodMS) {
|
||||
Tracker() : nsExpirationTracker<Object,K>(periodMS, "Tracker") {
|
||||
Object* obj = new Object();
|
||||
mUniverse.AppendElement(obj);
|
||||
LogAction(obj, "Created");
|
||||
|
Loading…
Reference in New Issue
Block a user