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

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

Issue 424633002: Oilpan: Prepare to move Resource to Oilpan heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: unregister -> register Created 6 years, 5 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') | no next file » | 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 7e6112b5884ea82d26e084c7d9b5785d95194997..9dbab36313ef9583d14b0a72c32ab1bc17fe41ab 100644
--- a/Source/core/fetch/Resource.cpp
+++ b/Source/core/fetch/Resource.cpp
@@ -116,13 +116,14 @@ Resource::Resource(const ResourceRequest& request, Type type)
#ifdef ENABLE_RESOURCE_IS_DELETED_CHECK
, m_deleted(false)
#endif
- , m_resourceToRevalidate(0)
- , m_proxyResource(0)
+ , m_resourceToRevalidate(nullptr)
+ , m_proxyResource(nullptr)
{
ASSERT(m_type == unsigned(type)); // m_type is a bitfield, so this tests careless updates of the enum.
#ifndef NDEBUG
cachedResourceLeakCounter.increment();
#endif
+ memoryCache()->registerLiveResource(*this);
if (!m_resourceRequest.url().hasFragmentIdentifier())
return;
@@ -154,6 +155,12 @@ void Resource::dispose()
{
}
+void Resource::trace(Visitor* visitor)
+{
+ visitor->trace(m_resourceToRevalidate);
+ visitor->trace(m_proxyResource);
+}
+
void Resource::failBeforeStarting()
{
WTF_LOG(ResourceLoading, "Cannot start loading '%s'", url().string().latin1().data());
@@ -556,7 +563,10 @@ bool Resource::deleteIfPossible()
if (canDelete() && !memoryCache()->contains(this)) {
InspectorInstrumentation::willDestroyResource(this);
dispose();
+ memoryCache()->unregisterLiveResource(*this);
+#if !ENABLE(OILPAN)
delete this;
+#endif
return true;
}
return false;
@@ -654,11 +664,11 @@ void Resource::clearResourceToRevalidate()
// A resource may start revalidation before this method has been called, so check that this resource is still the proxy resource before clearing it out.
if (m_resourceToRevalidate->m_proxyResource == this) {
- m_resourceToRevalidate->m_proxyResource = 0;
+ m_resourceToRevalidate->m_proxyResource = nullptr;
m_resourceToRevalidate->deleteIfPossible();
}
m_handlesToRevalidate.clear();
- m_resourceToRevalidate = 0;
+ m_resourceToRevalidate = nullptr;
deleteIfPossible();
}
@@ -668,7 +678,7 @@ void Resource::switchClientsToRevalidatedResource()
ASSERT(memoryCache()->contains(m_resourceToRevalidate));
ASSERT(!memoryCache()->contains(this));
- WTF_LOG(ResourceLoading, "Resource %p switchClientsToRevalidatedResource %p", this, m_resourceToRevalidate);
+ WTF_LOG(ResourceLoading, "Resource %p switchClientsToRevalidatedResource %p", this, m_resourceToRevalidate.get());
m_resourceToRevalidate->m_identifier = m_identifier;
« no previous file with comments | « Source/core/fetch/Resource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698