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

Side by Side Diff: Source/core/loader/DocumentLoader.cpp

Issue 603903003: [Streams] Pass WebDataConsumerHandle when the response arrives. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@web-data-pipe
Patch Set: Created 6 years, 1 month 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 | « Source/core/loader/DocumentLoader.h ('k') | Source/core/loader/DocumentThreadableLoader.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, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 frame()->document()->enforceSandboxFlags(SandboxOrigin); 433 frame()->document()->enforceSandboxFlags(SandboxOrigin);
434 if (FrameOwner* owner = frame()->owner()) 434 if (FrameOwner* owner = frame()->owner())
435 owner->dispatchLoad(); 435 owner->dispatchLoad();
436 436
437 // The load event might have detached this frame. In that case, the load wil l already have been cancelled during detach. 437 // The load event might have detached this frame. In that case, the load wil l already have been cancelled during detach.
438 if (frameLoader()) 438 if (frameLoader())
439 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); 439 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url()));
440 return; 440 return;
441 } 441 }
442 442
443 void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse & response) 443 void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse & response, PassOwnPtr<WebDataConsumerHandle> handle)
444 { 444 {
445 ASSERT_UNUSED(resource, m_mainResource == resource); 445 ASSERT_UNUSED(resource, m_mainResource == resource);
446 ASSERT_UNUSED(handle, !handle);
446 RefPtr<DocumentLoader> protect(this); 447 RefPtr<DocumentLoader> protect(this);
447 448
448 m_applicationCacheHost->didReceiveResponseForMainResource(response); 449 m_applicationCacheHost->didReceiveResponseForMainResource(response);
449 450
450 // The memory cache doesn't understand the application cache or its caching rules. So if a main resource is served 451 // The memory cache doesn't understand the application cache or its caching rules. So if a main resource is served
451 // from the application cache, ensure we don't save the result for future us e. All responses loaded 452 // from the application cache, ensure we don't save the result for future us e. All responses loaded
452 // from appcache will have a non-zero appCacheID(). 453 // from appcache will have a non-zero appCacheID().
453 if (response.appCacheID()) 454 if (response.appCacheID())
454 memoryCache()->remove(m_mainResource.get()); 455 memoryCache()->remove(m_mainResource.get());
455 456
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 return false; 674 return false;
674 675
675 ASSERT(m_archiveResourceCollection); 676 ASSERT(m_archiveResourceCollection);
676 ArchiveResource* archiveResource = m_archiveResourceCollection->archiveResou rceForURL(request.url()); 677 ArchiveResource* archiveResource = m_archiveResourceCollection->archiveResou rceForURL(request.url());
677 if (!archiveResource) { 678 if (!archiveResource) {
678 cachedResource->error(Resource::LoadError); 679 cachedResource->error(Resource::LoadError);
679 return true; 680 return true;
680 } 681 }
681 682
682 cachedResource->setLoading(true); 683 cachedResource->setLoading(true);
683 cachedResource->responseReceived(archiveResource->response()); 684 cachedResource->responseReceived(archiveResource->response(), nullptr);
684 SharedBuffer* data = archiveResource->data(); 685 SharedBuffer* data = archiveResource->data();
685 if (data) 686 if (data)
686 cachedResource->appendData(data->data(), data->size()); 687 cachedResource->appendData(data->data(), data->size());
687 cachedResource->finish(); 688 cachedResource->finish();
688 return true; 689 return true;
689 } 690 }
690 691
691 const AtomicString& DocumentLoader::responseMIMEType() const 692 const AtomicString& DocumentLoader::responseMIMEType() const
692 { 693 {
693 return m_response.mimeType(); 694 return m_response.mimeType();
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR L() 836 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR L()
836 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn it& init, const String& source, Document* ownerDocument) 837 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn it& init, const String& source, Document* ownerDocument)
837 { 838 {
838 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true); 839 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true);
839 if (!source.isNull()) 840 if (!source.isNull())
840 m_writer->appendReplacingData(source); 841 m_writer->appendReplacingData(source);
841 endWriting(m_writer.get()); 842 endWriting(m_writer.get());
842 } 843 }
843 844
844 } // namespace blink 845 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/DocumentLoader.h ('k') | Source/core/loader/DocumentThreadableLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698