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

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

Issue 1586563014: Add <link rel=preload> onload support for scripts and styles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: USING_FAST_MALLOC Created 4 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
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 const ResourceRequest& DocumentLoader::request() const 153 const ResourceRequest& DocumentLoader::request() const
154 { 154 {
155 return m_request; 155 return m_request;
156 } 156 }
157 157
158 const KURL& DocumentLoader::url() const 158 const KURL& DocumentLoader::url() const
159 { 159 {
160 return m_request.url(); 160 return m_request.url();
161 } 161 }
162 162
163 void DocumentLoader::startPreload(Resource::Type type, FetchRequest& request) 163 ResourcePtr<Resource> DocumentLoader::startPreload(Resource::Type type, FetchReq uest& request)
164 { 164 {
165 ResourcePtr<Resource> resource; 165 ResourcePtr<Resource> resource;
166 switch (type) { 166 switch (type) {
167 case Resource::Image: 167 case Resource::Image:
168 resource = ImageResource::fetch(request, fetcher()); 168 resource = ImageResource::fetch(request, fetcher());
169 break; 169 break;
170 case Resource::Script: 170 case Resource::Script:
171 resource = ScriptResource::fetch(request, fetcher()); 171 resource = ScriptResource::fetch(request, fetcher());
172 break; 172 break;
173 case Resource::CSSStyleSheet: 173 case Resource::CSSStyleSheet:
(...skipping 15 matching lines...) Expand all
189 break; 189 break;
190 case Resource::LinkSubresource: 190 case Resource::LinkSubresource:
191 resource = RawResource::fetch(request, fetcher()); 191 resource = RawResource::fetch(request, fetcher());
192 break; 192 break;
193 default: 193 default:
194 ASSERT_NOT_REACHED(); 194 ASSERT_NOT_REACHED();
195 } 195 }
196 196
197 if (resource) 197 if (resource)
198 fetcher()->preloadStarted(resource.get()); 198 fetcher()->preloadStarted(resource.get());
199 return resource;
199 } 200 }
200 201
201 void DocumentLoader::didChangePerformanceTiming() 202 void DocumentLoader::didChangePerformanceTiming()
202 { 203 {
203 if (frame() && frame()->isMainFrame() && m_state >= Committed) { 204 if (frame() && frame()->isMainFrame() && m_state >= Committed) {
204 frameLoader()->client()->didChangePerformanceTiming(); 205 frameLoader()->client()->didChangePerformanceTiming();
205 } 206 }
206 } 207 }
207 208
208 void DocumentLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDoc umentNavigationSource sameDocumentNavigationSource) 209 void DocumentLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDoc umentNavigationSource sameDocumentNavigationSource)
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 { 846 {
846 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing); 847 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing);
847 if (!source.isNull()) 848 if (!source.isNull())
848 m_writer->appendReplacingData(source); 849 m_writer->appendReplacingData(source);
849 endWriting(m_writer.get()); 850 endWriting(m_writer.get());
850 } 851 }
851 852
852 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 853 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
853 854
854 } // namespace blink 855 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/DocumentLoader.h ('k') | third_party/WebKit/Source/core/loader/LinkLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698