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

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

Issue 976263002: HTML Imports: Teach preloader about HTML Imports. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 6 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 | « Source/core/html/parser/PreloadRequest.cpp ('k') | Source/core/testing/Internals.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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 return m_request; 138 return m_request;
139 } 139 }
140 140
141 const KURL& DocumentLoader::url() const 141 const KURL& DocumentLoader::url() const
142 { 142 {
143 return m_request.url(); 143 return m_request.url();
144 } 144 }
145 145
146 void DocumentLoader::startPreload(Resource::Type type, FetchRequest& request) 146 void DocumentLoader::startPreload(Resource::Type type, FetchRequest& request)
147 { 147 {
148 ASSERT(type == Resource::Script || type == Resource::CSSStyleSheet || type = = Resource::Image); 148 ASSERT(type == Resource::Script || type == Resource::CSSStyleSheet || type = = Resource::Image || type == Resource::ImportResource);
149 ResourcePtr<Resource> resource; 149 ResourcePtr<Resource> resource;
150 if (type == Resource::Image) 150 switch (type) {
151 case Resource::Image:
151 resource = ImageResource::fetch(request, fetcher()); 152 resource = ImageResource::fetch(request, fetcher());
152 else if (type == Resource::Script) 153 break;
154 case Resource::Script:
153 resource = ScriptResource::fetch(request, fetcher()); 155 resource = ScriptResource::fetch(request, fetcher());
154 else 156 break;
157 case Resource::CSSStyleSheet:
155 resource = CSSStyleSheetResource::fetch(request, fetcher()); 158 resource = CSSStyleSheetResource::fetch(request, fetcher());
159 break;
160 default: // Resource::ImportResource
161 resource = RawResource::fetchImport(request, fetcher());
162 break;
163 }
156 164
157 if (resource) 165 if (resource)
158 fetcher()->preloadStarted(resource.get()); 166 fetcher()->preloadStarted(resource.get());
159 } 167 }
160 168
161 void DocumentLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDoc umentNavigationSource sameDocumentNavigationSource) 169 void DocumentLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDoc umentNavigationSource sameDocumentNavigationSource)
162 { 170 {
163 KURL oldURL = m_request.url(); 171 KURL oldURL = m_request.url();
164 m_originalRequest.setURL(newURL); 172 m_originalRequest.setURL(newURL);
165 m_request.setURL(newURL); 173 m_request.setURL(newURL);
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR L() 799 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR L()
792 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn it& init, const String& source, Document* ownerDocument) 800 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn it& init, const String& source, Document* ownerDocument)
793 { 801 {
794 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing); 802 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing);
795 if (!source.isNull()) 803 if (!source.isNull())
796 m_writer->appendReplacingData(source); 804 m_writer->appendReplacingData(source);
797 endWriting(m_writer.get()); 805 endWriting(m_writer.get());
798 } 806 }
799 807
800 } // namespace blink 808 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/parser/PreloadRequest.cpp ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698