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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ResourceLoader.cpp

Issue 2014483003: Rename OwnPtr::clear() to reset() in core/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved.
3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 void ResourceLoader::didReceiveResponse(WebURLLoader*, const WebURLResponse& res ponse, WebDataConsumerHandle* rawHandle) 147 void ResourceLoader::didReceiveResponse(WebURLLoader*, const WebURLResponse& res ponse, WebDataConsumerHandle* rawHandle)
148 { 148 {
149 ASSERT(!response.isNull()); 149 ASSERT(!response.isNull());
150 // |rawHandle|'s ownership is transferred to the callee. 150 // |rawHandle|'s ownership is transferred to the callee.
151 OwnPtr<WebDataConsumerHandle> handle = adoptPtr(rawHandle); 151 OwnPtr<WebDataConsumerHandle> handle = adoptPtr(rawHandle);
152 const ResourceResponse& resourceResponse = response.toResourceResponse(); 152 const ResourceResponse& resourceResponse = response.toResourceResponse();
153 153
154 if (responseNeedsAccessControlCheck()) { 154 if (responseNeedsAccessControlCheck()) {
155 if (response.wasFetchedViaServiceWorker()) { 155 if (response.wasFetchedViaServiceWorker()) {
156 if (response.wasFallbackRequiredByServiceWorker()) { 156 if (response.wasFallbackRequiredByServiceWorker()) {
157 m_loader.clear(); 157 m_loader.reset();
158 m_loader = adoptPtr(Platform::current()->createURLLoader()); 158 m_loader = adoptPtr(Platform::current()->createURLLoader());
159 ASSERT(m_loader); 159 ASSERT(m_loader);
160 ResourceRequest request = m_resource->lastResourceRequest(); 160 ResourceRequest request = m_resource->lastResourceRequest();
161 ASSERT(!request.skipServiceWorker()); 161 ASSERT(!request.skipServiceWorker());
162 request.setSkipServiceWorker(true); 162 request.setSkipServiceWorker(true);
163 m_loader->loadAsynchronously(WrappedResourceRequest(request), th is); 163 m_loader->loadAsynchronously(WrappedResourceRequest(request), th is);
164 return; 164 return;
165 } 165 }
166 } else { 166 } else {
167 if (!m_resource->isCacheValidator() || resourceResponse.httpStatusCo de() != 304) 167 if (!m_resource->isCacheValidator() || resourceResponse.httpStatusCo de() != 304)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 m_resource->appendData(data, length); 199 m_resource->appendData(data, length);
200 } 200 }
201 201
202 void ResourceLoader::didFinishLoadingFirstPartInMultipart() 202 void ResourceLoader::didFinishLoadingFirstPartInMultipart()
203 { 203 {
204 m_fetcher->didFinishLoading(m_resource.get(), 0, WebURLLoaderClient::kUnknow nEncodedDataLength, ResourceFetcher::DidFinishFirstPartInMultipart); 204 m_fetcher->didFinishLoading(m_resource.get(), 0, WebURLLoaderClient::kUnknow nEncodedDataLength, ResourceFetcher::DidFinishFirstPartInMultipart);
205 } 205 }
206 206
207 void ResourceLoader::didFinishLoading(WebURLLoader*, double finishTime, int64_t encodedDataLength) 207 void ResourceLoader::didFinishLoading(WebURLLoader*, double finishTime, int64_t encodedDataLength)
208 { 208 {
209 m_loader.clear(); 209 m_loader.reset();
210 m_fetcher->didFinishLoading(m_resource.get(), finishTime, encodedDataLength, ResourceFetcher::DidFinishLoading); 210 m_fetcher->didFinishLoading(m_resource.get(), finishTime, encodedDataLength, ResourceFetcher::DidFinishLoading);
211 } 211 }
212 212
213 void ResourceLoader::didFail(WebURLLoader*, const WebURLError& error) 213 void ResourceLoader::didFail(WebURLLoader*, const WebURLError& error)
214 { 214 {
215 m_loader.clear(); 215 m_loader.reset();
216 m_fetcher->didFailLoading(m_resource.get(), error); 216 m_fetcher->didFailLoading(m_resource.get(), error);
217 } 217 }
218 218
219 void ResourceLoader::requestSynchronously(ResourceRequest& request) 219 void ResourceLoader::requestSynchronously(ResourceRequest& request)
220 { 220 {
221 // downloadToFile is not supported for synchronous requests. 221 // downloadToFile is not supported for synchronous requests.
222 ASSERT(!request.downloadToFile()); 222 ASSERT(!request.downloadToFile());
223 ASSERT(m_loader); 223 ASSERT(m_loader);
224 224
225 // Synchronous requests should always be max priority, lest they hang the re nderer. 225 // Synchronous requests should always be max priority, lest they hang the re nderer.
(...skipping 30 matching lines...) Expand all
256 // empty buffer is a noop in most cases, but is destructive in the case of 256 // empty buffer is a noop in most cases, but is destructive in the case of
257 // a 304, where it will overwrite the cached data we should be reusing. 257 // a 304, where it will overwrite the cached data we should be reusing.
258 if (dataOut.size()) { 258 if (dataOut.size()) {
259 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size (), encodedDataLength); 259 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size (), encodedDataLength);
260 m_resource->setResourceBuffer(dataOut); 260 m_resource->setResourceBuffer(dataOut);
261 } 261 }
262 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); 262 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength);
263 } 263 }
264 264
265 } // namespace blink 265 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/FontResource.cpp ('k') | third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698