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

Side by Side Diff: Source/WebCore/loader/SubresourceLoader.cpp

Issue 12039077: Merge 139551 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // After the first multipart section is complete, signal to delegates th at this load is "finished" 206 // After the first multipart section is complete, signal to delegates th at this load is "finished"
207 m_documentLoader->subresourceLoaderFinishedLoadingOnePart(this); 207 m_documentLoader->subresourceLoaderFinishedLoadingOnePart(this);
208 didFinishLoadingOnePart(0); 208 didFinishLoadingOnePart(0);
209 } 209 }
210 210
211 checkForHTTPStatusCodeError(); 211 checkForHTTPStatusCodeError();
212 } 212 }
213 213
214 void SubresourceLoader::didReceiveData(const char* data, int length, long long e ncodedDataLength, bool allAtOnce) 214 void SubresourceLoader::didReceiveData(const char* data, int length, long long e ncodedDataLength, bool allAtOnce)
215 { 215 {
216 if (m_resource->response().httpStatusCode() >= 400 && !m_resource->shouldIgn oreHTTPStatusCodeErrors())
217 return;
216 ASSERT(!m_resource->resourceToRevalidate()); 218 ASSERT(!m_resource->resourceToRevalidate());
217 ASSERT(!m_resource->errorOccurred()); 219 ASSERT(!m_resource->errorOccurred());
218 ASSERT(m_state == Initialized); 220 ASSERT(m_state == Initialized);
219 // Reference the object in this method since the additional processing can d o 221 // Reference the object in this method since the additional processing can d o
220 // anything including removing the last reference to this object; one exampl e of this is 3266216. 222 // anything including removing the last reference to this object; one exampl e of this is 3266216.
221 RefPtr<SubresourceLoader> protect(this); 223 RefPtr<SubresourceLoader> protect(this);
222 addData(data, length, allAtOnce); 224 addData(data, length, allAtOnce);
223 if (!m_loadingMultipartContent) 225 if (!m_loadingMultipartContent)
224 sendDataToResource(data, length); 226 sendDataToResource(data, length);
225 if (shouldSendResourceLoadCallbacks() && m_frame) 227 if (shouldSendResourceLoadCallbacks() && m_frame)
226 frameLoader()->notifier()->didReceiveData(this, data, length, static_cas t<int>(encodedDataLength)); 228 frameLoader()->notifier()->didReceiveData(this, data, length, static_cas t<int>(encodedDataLength));
227 } 229 }
228 230
229 bool SubresourceLoader::checkForHTTPStatusCodeError() 231 bool SubresourceLoader::checkForHTTPStatusCodeError()
230 { 232 {
231 if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnor eHTTPStatusCodeErrors()) 233 if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnor eHTTPStatusCodeErrors())
232 return false; 234 return false;
233 235
236 m_state = Finishing;
234 m_resource->error(CachedResource::LoadError); 237 m_resource->error(CachedResource::LoadError);
235 m_state = Finishing;
236 cancel(); 238 cancel();
237 return true; 239 return true;
238 } 240 }
239 241
240 void SubresourceLoader::sendDataToResource(const char* data, int length) 242 void SubresourceLoader::sendDataToResource(const char* data, int length)
241 { 243 {
242 // There are two cases where we might need to create our own SharedBuffer in stead of copying the one in ResourceLoader. 244 // There are two cases where we might need to create our own SharedBuffer in stead of copying the one in ResourceLoader.
243 // (1) Multipart content: The loader delivers the data in a multipart sectio n all at once, then sends eof. 245 // (1) Multipart content: The loader delivers the data in a multipart sectio n all at once, then sends eof.
244 // The resource data will change as the next part is loaded, so we need to make a copy. 246 // The resource data will change as the next part is loaded, so we need to make a copy.
245 // (2) Our client requested that the data not be buffered at the ResourceLoa der level via ResourceLoaderOptions. In this case, 247 // (2) Our client requested that the data not be buffered at the ResourceLoa der level via ResourceLoaderOptions. In this case,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 m_documentLoader->cachedResourceLoader()->loadDone(m_resource); 320 m_documentLoader->cachedResourceLoader()->loadDone(m_resource);
319 if (reachedTerminalState()) 321 if (reachedTerminalState())
320 return; 322 return;
321 m_resource->stopLoading(); 323 m_resource->stopLoading();
322 m_documentLoader->removeSubresourceLoader(this); 324 m_documentLoader->removeSubresourceLoader(this);
323 } 325 }
324 ResourceLoader::releaseResources(); 326 ResourceLoader::releaseResources();
325 } 327 }
326 328
327 } 329 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698