Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Unified Diff: Source/core/fetch/Resource.cpp

Issue 450183002: Add instance counters of Resource and AudioNode, and expose them via WebLeakDetector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/fetch/Resource.h ('k') | Source/modules/webaudio/AudioNode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/Resource.cpp
diff --git a/Source/core/fetch/Resource.cpp b/Source/core/fetch/Resource.cpp
index 8e0389e6bd3e42b08d098641316bbac90870e101..ff898e2a129f2decc402aee403328c16bf45330b 100644
--- a/Source/core/fetch/Resource.cpp
+++ b/Source/core/fetch/Resource.cpp
@@ -93,6 +93,7 @@ static inline bool shouldUpdateHeaderAfterRevalidation(const AtomicString& heade
}
DEFINE_DEBUG_ONLY_GLOBAL(RefCountedLeakCounter, cachedResourceLeakCounter, ("Resource"));
+unsigned Resource::s_instanceCount = 0;
Resource::Resource(const ResourceRequest& request, Type type)
: m_resourceRequest(request)
@@ -120,6 +121,7 @@ Resource::Resource(const ResourceRequest& request, Type type)
, m_proxyResource(nullptr)
{
ASSERT(m_type == unsigned(type)); // m_type is a bitfield, so this tests careless updates of the enum.
+ ++s_instanceCount;
#ifndef NDEBUG
cachedResourceLeakCounter.increment();
#endif
@@ -149,6 +151,7 @@ Resource::~Resource()
#ifndef NDEBUG
cachedResourceLeakCounter.decrement();
#endif
+ --s_instanceCount;
}
void Resource::dispose()
« no previous file with comments | « Source/core/fetch/Resource.h ('k') | Source/modules/webaudio/AudioNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698