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

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

Issue 13866038: Revert 148069 and 148060 to see if they were responsible for a perf regression (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/WebCore/loader/ResourceLoader.h ('k') | Source/WebCore/loader/SubresourceLoader.h » ('j') | 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, 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 ResourceLoader::RequestCountTracker::~RequestCountTracker() 59 ResourceLoader::RequestCountTracker::~RequestCountTracker()
60 { 60 {
61 m_cachedResourceLoader->decrementRequestCount(m_resource); 61 m_cachedResourceLoader->decrementRequestCount(m_resource);
62 } 62 }
63 63
64 PassRefPtr<ResourceBuffer> ResourceLoader::resourceData() 64 PassRefPtr<ResourceBuffer> ResourceLoader::resourceData()
65 { 65 {
66 return m_resourceData; 66 return m_resourceData;
67 } 67 }
68 68
69 PassRefPtr<ResourceLoader> ResourceLoader::create(Frame* frame, CachedResource* resource, const ResourceRequest& request, const ResourceLoaderOptions& options)
70 {
71 RefPtr<ResourceLoader> loader(adoptRef(new ResourceLoader(frame, resource, o ptions)));
72 if (!loader->init(request))
73 return 0;
74 loader->start();
75 return loader.release();
76 }
77
78 ResourceLoader::ResourceLoader(Frame* frame, CachedResource* resource, ResourceL oaderOptions options) 69 ResourceLoader::ResourceLoader(Frame* frame, CachedResource* resource, ResourceL oaderOptions options)
79 : m_frame(frame) 70 : m_frame(frame)
80 , m_documentLoader(frame->loader()->activeDocumentLoader()) 71 , m_documentLoader(frame->loader()->activeDocumentLoader())
81 , m_identifier(0) 72 , m_identifier(0)
82 , m_loadingMultipartContent(false) 73 , m_loadingMultipartContent(false)
83 , m_reachedTerminalState(false) 74 , m_reachedTerminalState(false)
84 , m_cancelled(false) 75 , m_cancelled(false)
85 , m_notifiedLoadComplete(false) 76 , m_notifiedLoadComplete(false)
86 , m_defersLoading(frame->page()->defersLoading()) 77 , m_defersLoading(frame->page()->defersLoading())
87 , m_options(options) 78 , m_options(options)
88 , m_resource(resource) 79 , m_resource(resource)
89 , m_state(Uninitialized) 80 , m_state(Uninitialized)
90 , m_requestCountTracker(adoptPtr(new RequestCountTracker(frame->document()-> cachedResourceLoader(), resource))) 81 , m_requestCountTracker(adoptPtr(new RequestCountTracker(frame->document()-> cachedResourceLoader(), resource)))
91 { 82 {
92 } 83 }
93 84
94 ResourceLoader::~ResourceLoader() 85 ResourceLoader::~ResourceLoader()
95 { 86 {
96 ASSERT(m_state != Initialized);
97 ASSERT(m_reachedTerminalState); 87 ASSERT(m_reachedTerminalState);
98 } 88 }
99 89
100 void ResourceLoader::releaseResources() 90 void ResourceLoader::releaseResources()
101 { 91 {
102 ASSERT(!reachedTerminalState());
103 if (m_state != Uninitialized) {
104 m_requestCountTracker.clear();
105 m_documentLoader->cachedResourceLoader()->loadDone(m_resource);
106 if (reachedTerminalState())
107 return;
108 m_resource->stopLoading();
109 m_documentLoader->removeResourceLoader(this);
110 }
111
112 ASSERT(!m_reachedTerminalState); 92 ASSERT(!m_reachedTerminalState);
113 93
114 // It's possible that when we release the handle, it will be 94 // It's possible that when we release the handle, it will be
115 // deallocated and release the last reference to this object. 95 // deallocated and release the last reference to this object.
116 // We need to retain to avoid accessing the object after it 96 // We need to retain to avoid accessing the object after it
117 // has been deallocated and also to avoid reentering this method. 97 // has been deallocated and also to avoid reentering this method.
118 RefPtr<ResourceLoader> protector(this); 98 RefPtr<ResourceLoader> protector(this);
119 99
120 m_frame = 0; 100 m_frame = 0;
121 m_documentLoader = 0; 101 m_documentLoader = 0;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // https://bugs.webkit.org/show_bug.cgi?id=26391 137 // https://bugs.webkit.org/show_bug.cgi?id=26391
158 // The various plug-in implementations call directly to ResourceLoader::load () instead of piping requests 138 // The various plug-in implementations call directly to ResourceLoader::load () instead of piping requests
159 // through FrameLoader. As a result, they miss the FrameLoader::addExtraFiel dsToRequest() step which sets 139 // through FrameLoader. As a result, they miss the FrameLoader::addExtraFiel dsToRequest() step which sets
160 // up the 1st party for cookies URL. Until plug-in implementations can be re igned in to pipe through that 140 // up the 1st party for cookies URL. Until plug-in implementations can be re igned in to pipe through that
161 // method, we need to make sure there is always a 1st party for cookies set. 141 // method, we need to make sure there is always a 1st party for cookies set.
162 if (clientRequest.firstPartyForCookies().isNull()) { 142 if (clientRequest.firstPartyForCookies().isNull()) {
163 if (Document* document = m_frame->document()) 143 if (Document* document = m_frame->document())
164 clientRequest.setFirstPartyForCookies(document->firstPartyForCookies ()); 144 clientRequest.setFirstPartyForCookies(document->firstPartyForCookies ());
165 } 145 }
166 146
167 willSendRequest(0, clientRequest, ResourceResponse()); 147 willSendRequest(clientRequest, ResourceResponse());
168 if (clientRequest.isNull()) { 148 if (clientRequest.isNull()) {
169 cancel(); 149 cancel();
170 return false; 150 return false;
171 } 151 }
172 ASSERT(!reachedTerminalState());
173 152
174 m_originalRequest = m_request = clientRequest; 153 m_originalRequest = m_request = clientRequest;
175 m_state = Initialized;
176 m_documentLoader->addResourceLoader(this);
177 return true; 154 return true;
178 } 155 }
179 156
180 void ResourceLoader::start() 157 void ResourceLoader::start()
181 { 158 {
182 ASSERT(!m_handle); 159 ASSERT(!m_handle);
183 ASSERT(!m_request.isNull()); 160 ASSERT(!m_request.isNull());
184 ASSERT(m_deferredRequest.isNull()); 161 ASSERT(m_deferredRequest.isNull());
185 162
186 if (m_documentLoader->scheduleArchiveLoad(this, m_request)) 163 if (m_documentLoader->scheduleArchiveLoad(this, m_request))
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 else 214 else
238 m_resourceData = ResourceBuffer::create(data, length); 215 m_resourceData = ResourceBuffer::create(data, length);
239 } 216 }
240 217
241 void ResourceLoader::clearResourceData() 218 void ResourceLoader::clearResourceData()
242 { 219 {
243 if (m_resourceData) 220 if (m_resourceData)
244 m_resourceData->clear(); 221 m_resourceData->clear();
245 } 222 }
246 223
224 void ResourceLoader::willSendRequest(ResourceRequest& request, const ResourceRes ponse& redirectResponse)
225 {
226 // Protect this in this delegate method since the additional processing can do
227 // anything including possibly derefing this; one example of this is Radar 3 266216.
228 RefPtr<ResourceLoader> protector(this);
229
230 ASSERT(!m_reachedTerminalState);
231
232 // We need a resource identifier for all requests, even if FrameLoader is ne ver going to see it (such as with CORS preflight requests).
233 bool createdResourceIdentifier = false;
234 if (!m_identifier) {
235 m_identifier = m_frame->page()->progress()->createUniqueIdentifier();
236 createdResourceIdentifier = true;
237 }
238
239 if (m_options.sendLoadCallbacks == SendCallbacks) {
240 if (createdResourceIdentifier)
241 frameLoader()->notifier()->assignIdentifierToInitialRequest(m_identi fier, documentLoader(), request);
242
243 frameLoader()->notifier()->willSendRequest(this, request, redirectRespon se);
244 }
245 else
246 InspectorInstrumentation::willSendRequest(m_frame.get(), m_identifier, m _frame->loader()->documentLoader(), request, redirectResponse);
247
248 m_request = request;
249
250 if (!redirectResponse.isNull() && !m_documentLoader->isCommitted())
251 frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalL oad();
252 }
253
254 void ResourceLoader::didReceiveResponse(const ResourceResponse& r)
255 {
256 ASSERT(!m_reachedTerminalState);
257
258 // Protect this in this delegate method since the additional processing can do
259 // anything including possibly derefing this; one example of this is Radar 3 266216.
260 RefPtr<ResourceLoader> protector(this);
261
262 m_response = r;
263
264 if (FormData* data = m_request.httpBody())
265 data->removeGeneratedFilesIfNeeded();
266
267 if (m_options.sendLoadCallbacks == SendCallbacks)
268 frameLoader()->notifier()->didReceiveResponse(this, m_response);
269 }
270
247 void ResourceLoader::didDownloadData(ResourceHandle*, int length) 271 void ResourceLoader::didDownloadData(ResourceHandle*, int length)
248 { 272 {
249 if (!m_cancelled && !fastMallocSize(documentLoader()->applicationCacheHost() )) 273 if (!m_cancelled && !fastMallocSize(documentLoader()->applicationCacheHost() ))
250 CRASH(); 274 CRASH();
251 if (!m_cancelled && !fastMallocSize(documentLoader()->frame())) 275 if (!m_cancelled && !fastMallocSize(documentLoader()->frame()))
252 CRASH(); 276 CRASH();
253 RefPtr<ResourceLoader> protect(this); 277 RefPtr<ResourceLoader> protect(this);
254 m_resource->didDownloadData(length); 278 m_resource->didDownloadData(length);
255 } 279 }
256 280
281 void ResourceLoader::didFinishLoading(double finishTime)
282 {
283 didFinishLoadingOnePart(finishTime);
284
285 // If the load has been cancelled by a delegate in response to didFinishLoad (), do not release
286 // the resources a second time, they have been released by cancel.
287 if (m_cancelled)
288 return;
289 releaseResources();
290 }
291
257 void ResourceLoader::didFinishLoadingOnePart(double finishTime) 292 void ResourceLoader::didFinishLoadingOnePart(double finishTime)
258 { 293 {
259 // If load has been cancelled after finishing (which could happen with a 294 // If load has been cancelled after finishing (which could happen with a
260 // JavaScript that changes the window location), do nothing. 295 // JavaScript that changes the window location), do nothing.
261 if (m_cancelled) 296 if (m_cancelled)
262 return; 297 return;
263 ASSERT(!m_reachedTerminalState); 298 ASSERT(!m_reachedTerminalState);
264 299
265 if (m_notifiedLoadComplete) 300 if (m_notifiedLoadComplete)
266 return; 301 return;
267 m_notifiedLoadComplete = true; 302 m_notifiedLoadComplete = true;
268 if (m_options.sendLoadCallbacks == SendCallbacks) 303 if (m_options.sendLoadCallbacks == SendCallbacks)
269 frameLoader()->notifier()->didFinishLoad(this, finishTime); 304 frameLoader()->notifier()->didFinishLoad(this, finishTime);
270 } 305 }
271 306
307 void ResourceLoader::didFail(const ResourceError& error)
308 {
309 if (m_cancelled)
310 return;
311 ASSERT(!m_reachedTerminalState);
312
313 // Protect this in this delegate method since the additional processing can do
314 // anything including possibly derefing this; one example of this is Radar 3 266216.
315 RefPtr<ResourceLoader> protector(this);
316
317 if (FormData* data = m_request.httpBody())
318 data->removeGeneratedFilesIfNeeded();
319
320 if (!m_notifiedLoadComplete) {
321 m_notifiedLoadComplete = true;
322 if (m_options.sendLoadCallbacks == SendCallbacks)
323 frameLoader()->notifier()->didFailToLoad(this, error);
324 }
325
326 releaseResources();
327 }
328
272 void ResourceLoader::didChangePriority(ResourceLoadPriority loadPriority) 329 void ResourceLoader::didChangePriority(ResourceLoadPriority loadPriority)
273 { 330 {
274 if (handle()) { 331 if (handle()) {
275 frameLoader()->client()->dispatchDidChangeResourcePriority(identifier(), loadPriority); 332 frameLoader()->client()->dispatchDidChangeResourcePriority(identifier(), loadPriority);
276 handle()->didChangePriority(loadPriority); 333 handle()->didChangePriority(loadPriority);
277 } 334 }
278 } 335 }
279 336
280 void ResourceLoader::cancelIfNotFinishing() 337 void ResourceLoader::cancelIfNotFinishing()
281 { 338 {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 401
345 ResourceError ResourceLoader::cannotShowURLError() 402 ResourceError ResourceLoader::cannotShowURLError()
346 { 403 {
347 return frameLoader()->client()->cannotShowURLError(m_request); 404 return frameLoader()->client()->cannotShowURLError(m_request);
348 } 405 }
349 406
350 void ResourceLoader::willSendRequest(ResourceHandle*, ResourceRequest& request, const ResourceResponse& redirectResponse) 407 void ResourceLoader::willSendRequest(ResourceHandle*, ResourceRequest& request, const ResourceResponse& redirectResponse)
351 { 408 {
352 if (documentLoader()->applicationCacheHost()->maybeLoadFallbackForRedirect(t his, request, redirectResponse)) 409 if (documentLoader()->applicationCacheHost()->maybeLoadFallbackForRedirect(t his, request, redirectResponse))
353 return; 410 return;
354 411 willSendRequest(request, redirectResponse);
355 // Store the previous URL because we may modify it.
356 KURL previousURL = m_request.url();
357 RefPtr<ResourceLoader> protect(this);
358
359 ASSERT(!request.isNull());
360 if (!redirectResponse.isNull()) {
361 if (!m_documentLoader->cachedResourceLoader()->canRequest(m_resource->ty pe(), request.url())) {
362 cancel();
363 return;
364 }
365 if (m_resource->type() == CachedResource::ImageResource && m_documentLoa der->cachedResourceLoader()->shouldDeferImageLoad(request.url())) {
366 cancel();
367 return;
368 }
369 m_resource->willSendRequest(request, redirectResponse);
370 }
371
372 if (request.isNull() || reachedTerminalState())
373 return;
374
375 // We need a resource identifier for all requests, even if FrameLoader is ne ver going to see it (such as with CORS preflight requests).
376 bool createdResourceIdentifier = false;
377 if (!m_identifier) {
378 m_identifier = m_frame->page()->progress()->createUniqueIdentifier();
379 createdResourceIdentifier = true;
380 }
381
382 if (m_options.sendLoadCallbacks == SendCallbacks) {
383 if (createdResourceIdentifier)
384 frameLoader()->notifier()->assignIdentifierToInitialRequest(m_identi fier, documentLoader(), request);
385
386 frameLoader()->notifier()->willSendRequest(this, request, redirectRespon se);
387 }
388 else
389 InspectorInstrumentation::willSendRequest(m_frame.get(), m_identifier, m _frame->loader()->documentLoader(), request, redirectResponse);
390
391 m_request = request;
392
393 if (!redirectResponse.isNull() && !m_documentLoader->isCommitted())
394 frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalL oad();
395
396 if (request.isNull())
397 cancel();
398 }
399
400 void ResourceLoader::didReceiveCachedMetadata(ResourceHandle*, const char* data, int length)
401 {
402 ASSERT(m_state == Initialized);
403 ASSERT(!m_resource->resourceToRevalidate());
404 m_resource->setSerializedCachedMetadata(data, length);
405 } 412 }
406 413
407 void ResourceLoader::didSendData(ResourceHandle*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) 414 void ResourceLoader::didSendData(ResourceHandle*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
408 { 415 {
409 ASSERT(m_state == Initialized); 416 ASSERT(m_state == Initialized);
410 RefPtr<ResourceLoader> protect(this); 417 RefPtr<ResourceLoader> protect(this);
411 m_resource->didSendData(bytesSent, totalBytesToBeSent); 418 m_resource->didSendData(bytesSent, totalBytesToBeSent);
412 } 419 }
413 420
414 void ResourceLoader::didReceiveResponse(ResourceHandle*, const ResourceResponse& response) 421 void ResourceLoader::didReceiveResponse(ResourceHandle*, const ResourceResponse& response)
415 { 422 {
416 if (documentLoader()->applicationCacheHost()->maybeLoadFallbackForResponse(t his, response)) 423 if (documentLoader()->applicationCacheHost()->maybeLoadFallbackForResponse(t his, response))
417 return; 424 return;
418 ASSERT(!response.isNull()); 425 didReceiveResponse(response);
419 ASSERT(m_state == Initialized);
420
421 // Reference the object in this method since the additional processing can d o
422 // anything including removing the last reference to this object.
423 RefPtr<ResourceLoader> protect(this);
424
425 if (m_resource->resourceToRevalidate()) {
426 if (response.httpStatusCode() == 304) {
427 // 304 Not modified / Use local copy
428 // Existing resource is ok, just use it updating the expiration time .
429 m_resource->setResponse(response);
430 memoryCache()->revalidationSucceeded(m_resource, response);
431 if (reachedTerminalState())
432 return;
433
434 if (FormData* data = m_request.httpBody())
435 data->removeGeneratedFilesIfNeeded();
436 if (m_options.sendLoadCallbacks == SendCallbacks)
437 frameLoader()->notifier()->didReceiveResponse(this, response);
438 return;
439 }
440 // Did not get 304 response, continue as a regular resource load.
441 memoryCache()->revalidationFailed(m_resource);
442 }
443
444 m_resource->responseReceived(response);
445 if (reachedTerminalState())
446 return;
447
448 if (FormData* data = m_request.httpBody())
449 data->removeGeneratedFilesIfNeeded();
450 if (m_options.sendLoadCallbacks == SendCallbacks)
451 frameLoader()->notifier()->didReceiveResponse(this, response);
452
453 // FIXME: Main resources have a different set of rules for multipart than im ages do.
454 // Hopefully we can merge those 2 paths.
455 if (response.isMultipart() && m_resource->type() != CachedResource::MainReso urce) {
456 m_loadingMultipartContent = true;
457
458 // We don't count multiParts in a CachedResourceLoader's request count
459 m_requestCountTracker.clear();
460 if (!m_resource->isImage()) {
461 cancel();
462 return;
463 }
464 }
465
466 RefPtr<ResourceBuffer> buffer = resourceData();
467 if (m_loadingMultipartContent && buffer && buffer->size()) {
468 sendDataToResource(buffer->data(), buffer->size());
469 clearResourceData();
470 // Since a subresource loader does not load multipart sections progressi vely, data was delivered to the loader all at once.
471 // After the first multipart section is complete, signal to delegates th at this load is "finished"
472 m_documentLoader->subresourceLoaderFinishedLoadingOnePart(this);
473 didFinishLoadingOnePart(0);
474 }
475
476 if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnor eHTTPStatusCodeErrors())
477 return;
478 m_state = Finishing;
479 m_resource->error(CachedResource::LoadError);
480 cancel();
481 } 426 }
482 427
483 void ResourceLoader::didReceiveData(ResourceHandle*, const char* data, int lengt h, int encodedDataLength) 428 void ResourceLoader::didReceiveData(ResourceHandle*, const char* data, int lengt h, int encodedDataLength)
484 { 429 {
485 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiv eResourceData(m_frame.get(), identifier(), encodedDataLength); 430 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiv eResourceData(m_frame.get(), identifier(), encodedDataLength);
486 431
487 if (m_resource->response().httpStatusCode() >= 400 && !m_resource->shouldIgn oreHTTPStatusCodeErrors()) 432 if (m_resource->response().httpStatusCode() >= 400 && !m_resource->shouldIgn oreHTTPStatusCodeErrors())
488 return; 433 return;
489 ASSERT(!m_resource->resourceToRevalidate()); 434 ASSERT(!m_resource->resourceToRevalidate());
490 ASSERT(!m_resource->errorOccurred()); 435 ASSERT(!m_resource->errorOccurred());
(...skipping 27 matching lines...) Expand all
518 // that all data has been received yet. 463 // that all data has been received yet.
519 if (m_loadingMultipartContent || !resourceData()) { 464 if (m_loadingMultipartContent || !resourceData()) {
520 RefPtr<ResourceBuffer> copiedData = ResourceBuffer::create(data, length) ; 465 RefPtr<ResourceBuffer> copiedData = ResourceBuffer::create(data, length) ;
521 m_resource->data(copiedData.release(), m_loadingMultipartContent); 466 m_resource->data(copiedData.release(), m_loadingMultipartContent);
522 } else 467 } else
523 m_resource->data(resourceData(), false); 468 m_resource->data(resourceData(), false);
524 } 469 }
525 470
526 void ResourceLoader::didFinishLoading(ResourceHandle*, double finishTime) 471 void ResourceLoader::didFinishLoading(ResourceHandle*, double finishTime)
527 { 472 {
528 if (m_state != Initialized) 473 didFinishLoading(finishTime);
529 return;
530 ASSERT(!reachedTerminalState());
531 ASSERT(!m_resource->resourceToRevalidate());
532 ASSERT(!m_resource->errorOccurred());
533 LOG(ResourceLoading, "Received '%s'.", m_resource->url().string().latin1().d ata());
534
535 RefPtr<ResourceLoader> protect(this);
536 CachedResourceHandle<CachedResource> protectResource(m_resource);
537 m_state = Finishing;
538 m_resource->setLoadFinishTime(finishTime);
539 m_resource->data(resourceData(), true);
540 m_resource->finish();
541 didFinishLoadingOnePart(finishTime);
542
543 // If the load has been cancelled by a delegate in response to didFinishLoad (), do not release
544 // the resources a second time, they have been released by cancel.
545 if (m_cancelled)
546 return;
547 releaseResources();
548 } 474 }
549 475
550 void ResourceLoader::didFail(ResourceHandle*, const ResourceError& error) 476 void ResourceLoader::didFail(ResourceHandle*, const ResourceError& error)
551 { 477 {
552 if (documentLoader()->applicationCacheHost()->maybeLoadFallbackForError(this , error) || m_state != Initialized) 478 if (documentLoader()->applicationCacheHost()->maybeLoadFallbackForError(this , error))
553 return; 479 return;
554 ASSERT(!reachedTerminalState()); 480 didFail(error);
555 LOG(ResourceLoading, "Failed to load '%s'.\n", m_resource->url().string().la tin1().data());
556
557 RefPtr<ResourceLoader> protect(this);
558 CachedResourceHandle<CachedResource> protectResource(m_resource);
559 m_state = Finishing;
560 if (m_resource->resourceToRevalidate())
561 memoryCache()->revalidationFailed(m_resource);
562 m_resource->setResourceError(error);
563 m_resource->error(CachedResource::LoadError);
564 if (!m_resource->isPreloaded())
565 memoryCache()->remove(m_resource);
566
567 if (m_cancelled)
568 return;
569 ASSERT(!m_reachedTerminalState);
570
571 if (FormData* data = m_request.httpBody())
572 data->removeGeneratedFilesIfNeeded();
573
574 if (!m_notifiedLoadComplete) {
575 m_notifiedLoadComplete = true;
576 if (m_options.sendLoadCallbacks == SendCallbacks)
577 frameLoader()->notifier()->didFailToLoad(this, error);
578 }
579
580 releaseResources();
581 } 481 }
582 482
583 bool ResourceLoader::shouldUseCredentialStorage(ResourceHandle*) 483 bool ResourceLoader::shouldUseCredentialStorage()
584 { 484 {
585 if (m_options.allowCredentials == DoNotAllowStoredCredentials) 485 if (m_options.allowCredentials == DoNotAllowStoredCredentials)
586 return false; 486 return false;
587 487
588 RefPtr<ResourceLoader> protector(this); 488 RefPtr<ResourceLoader> protector(this);
589 return frameLoader()->client()->shouldUseCredentialStorage(documentLoader(), identifier()); 489 return frameLoader()->client()->shouldUseCredentialStorage(documentLoader(), identifier());
590 } 490 }
591 491
592 void ResourceLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 492 void ResourceLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
593 { 493 {
594 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Loader); 494 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Loader);
595 info.addMember(m_handle, "handle"); 495 info.addMember(m_handle, "handle");
596 info.addMember(m_frame, "frame"); 496 info.addMember(m_frame, "frame");
597 info.addMember(m_documentLoader, "documentLoader"); 497 info.addMember(m_documentLoader, "documentLoader");
598 info.addMember(m_request, "request"); 498 info.addMember(m_request, "request");
599 info.addMember(m_originalRequest, "originalRequest"); 499 info.addMember(m_originalRequest, "originalRequest");
600 info.addMember(m_resourceData, "resourceData"); 500 info.addMember(m_resourceData, "resourceData");
601 info.addMember(m_deferredRequest, "deferredRequest"); 501 info.addMember(m_deferredRequest, "deferredRequest");
602 info.addMember(m_options, "options"); 502 info.addMember(m_options, "options");
603 info.addMember(m_resource, "resource"); 503 info.addMember(m_resource, "resource");
604 info.addMember(m_documentLoader, "documentLoader"); 504 info.addMember(m_documentLoader, "documentLoader");
605 info.addMember(m_requestCountTracker, "requestCountTracker"); 505 info.addMember(m_requestCountTracker, "requestCountTracker");
606 } 506 }
607 507
608 } 508 }
OLDNEW
« no previous file with comments | « Source/WebCore/loader/ResourceLoader.h ('k') | Source/WebCore/loader/SubresourceLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698