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

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

Issue 414423003: Oilpan: Prepare to move ResourceLoader and ResourceLoaderSet to Oilpan heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: FINAL 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
Index: Source/core/fetch/ResourceLoader.cpp
diff --git a/Source/core/fetch/ResourceLoader.cpp b/Source/core/fetch/ResourceLoader.cpp
index 5cd299f9eaab9c3d8a4c3c5de0b58cbd9c170542..2b734fb03b04167c8d617beb935970ede4f1ba7b 100644
--- a/Source/core/fetch/ResourceLoader.cpp
+++ b/Source/core/fetch/ResourceLoader.cpp
@@ -68,9 +68,9 @@ ResourceLoader::RequestCountTracker::RequestCountTracker(const RequestCountTrack
m_host->incrementRequestCount(m_resource);
}
-PassRefPtr<ResourceLoader> ResourceLoader::create(ResourceLoaderHost* host, Resource* resource, const ResourceRequest& request, const ResourceLoaderOptions& options)
+PassRefPtrWillBeRawPtr<ResourceLoader> ResourceLoader::create(ResourceLoaderHost* host, Resource* resource, const ResourceRequest& request, const ResourceLoaderOptions& options)
{
- RefPtr<ResourceLoader> loader(adoptRef(new ResourceLoader(host, resource, options)));
+ RefPtrWillBeRawPtr<ResourceLoader> loader(adoptRefWillBeNoop(new ResourceLoader(host, resource, options)));
loader->init(request);
return loader.release();
}
@@ -92,6 +92,12 @@ ResourceLoader::~ResourceLoader()
ASSERT(m_state == Terminated);
}
+void ResourceLoader::trace(Visitor* visitor)
+{
+ visitor->trace(m_host);
+ visitor->trace(m_resource);
+}
+
void ResourceLoader::releaseResources()
{
ASSERT(m_state != Terminated);
@@ -109,7 +115,7 @@ void ResourceLoader::releaseResources()
// deallocated and release the last reference to this object.
// We need to retain to avoid accessing the object after it
// has been deallocated and also to avoid reentering this method.
- RefPtr<ResourceLoader> protector(this);
+ RefPtrWillBeRawPtr<ResourceLoader> protector(this);
m_host.clear();
m_state = Terminated;
@@ -200,7 +206,7 @@ void ResourceLoader::attachThreadedDataReceiver(PassOwnPtr<blink::WebThreadedDat
void ResourceLoader::didDownloadData(blink::WebURLLoader*, int length, int encodedDataLength)
{
- RefPtr<ResourceLoader> protect(this);
+ RefPtrWillBeRawPtr<ResourceLoader> protect(this);
RELEASE_ASSERT(m_connectionState == ConnectionStateReceivedResponse);
m_host->didDownloadData(m_resource, length, encodedDataLength);
m_resource->didDownloadData(length);
@@ -253,7 +259,7 @@ void ResourceLoader::cancel(const ResourceError& error)
// This function calls out to clients at several points that might do
// something that causes the last reference to this object to go away.
- RefPtr<ResourceLoader> protector(this);
+ RefPtrWillBeRawPtr<ResourceLoader> protector(this);
WTF_LOG(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().string().latin1().data());
if (m_state == Initialized)
@@ -279,7 +285,7 @@ void ResourceLoader::cancel(const ResourceError& error)
void ResourceLoader::willSendRequest(blink::WebURLLoader*, blink::WebURLRequest& passedRequest, const blink::WebURLResponse& passedRedirectResponse)
{
- RefPtr<ResourceLoader> protect(this);
+ RefPtrWillBeRawPtr<ResourceLoader> protect(this);
ResourceRequest& request(applyOptions(passedRequest.toMutableResourceRequest()));
@@ -316,7 +322,7 @@ void ResourceLoader::didReceiveCachedMetadata(blink::WebURLLoader*, const char*
void ResourceLoader::didSendData(blink::WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
{
ASSERT(m_state == Initialized);
- RefPtr<ResourceLoader> protect(this);
+ RefPtrWillBeRawPtr<ResourceLoader> protect(this);
m_resource->didSendData(bytesSent, totalBytesToBeSent);
}
@@ -357,7 +363,7 @@ void ResourceLoader::didReceiveResponse(blink::WebURLLoader*, const blink::WebUR
// Reference the object in this method since the additional processing can do
// anything including removing the last reference to this object.
- RefPtr<ResourceLoader> protect(this);
+ RefPtrWillBeRawPtr<ResourceLoader> protect(this);
m_resource->responseReceived(resourceResponse);
if (m_state == Terminated)
return;
@@ -404,7 +410,7 @@ void ResourceLoader::didReceiveData(blink::WebURLLoader*, const char* data, int
// Reference the object in this method since the additional processing can do
// anything including removing the last reference to this object.
- RefPtr<ResourceLoader> protect(this);
+ RefPtrWillBeRawPtr<ResourceLoader> protect(this);
// FIXME: If we get a resource with more than 2B bytes, this code won't do the right thing.
// However, with today's computers and networking speeds, this won't happen in practice.
@@ -422,7 +428,7 @@ void ResourceLoader::didFinishLoading(blink::WebURLLoader*, double finishTime, i
ASSERT(m_state != Terminated);
WTF_LOG(ResourceLoading, "Received '%s'.", m_resource->url().string().latin1().data());
- RefPtr<ResourceLoader> protect(this);
+ RefPtrWillBeRawPtr<ResourceLoader> protect(this);
ResourcePtr<Resource> protectResource(m_resource);
m_state = Finishing;
didFinishLoadingOnePart(finishTime, encodedDataLength);
@@ -441,7 +447,7 @@ void ResourceLoader::didFail(blink::WebURLLoader*, const blink::WebURLError& err
ASSERT(m_state != Terminated);
WTF_LOG(ResourceLoading, "Failed to load '%s'.\n", m_resource->url().string().latin1().data());
- RefPtr<ResourceLoader> protect(this);
+ RefPtrWillBeRawPtr<ResourceLoader> protect(this);
RefPtrWillBeRawPtr<ResourceLoaderHost> protectHost(m_host.get());
ResourcePtr<Resource> protectResource(m_resource);
m_state = Finishing;
@@ -473,7 +479,7 @@ void ResourceLoader::requestSynchronously()
// downloadToFile is not supported for synchronous requests.
ASSERT(!m_request.downloadToFile());
- RefPtr<ResourceLoader> protect(this);
+ RefPtrWillBeRawPtr<ResourceLoader> protect(this);
RefPtrWillBeRawPtr<ResourceLoaderHost> protectHost(m_host.get());
ResourcePtr<Resource> protectResource(m_resource);

Powered by Google App Engine
This is Rietveld 408576698