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

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

Issue 1577073005: Add <link rel=preload> onload support for scripts and styles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Defeatedly removed image :/ 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, LinkLoader* linkLoader)
Nate Chapin 2016/01/15 18:53:58 linkLoader parameter looks unused.
Yoav Weiss 2016/01/15 21:40:25 yup
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 13 matching lines...) Expand all
187 break; 187 break;
188 case Resource::LinkSubresource: 188 case Resource::LinkSubresource:
189 resource = RawResource::fetch(request, fetcher()); 189 resource = RawResource::fetch(request, fetcher());
190 break; 190 break;
191 default: 191 default:
192 ASSERT_NOT_REACHED(); 192 ASSERT_NOT_REACHED();
193 } 193 }
194 194
195 if (resource) 195 if (resource)
196 fetcher()->preloadStarted(resource.get()); 196 fetcher()->preloadStarted(resource.get());
197 return resource;
197 } 198 }
198 199
199 void DocumentLoader::didChangePerformanceTiming() 200 void DocumentLoader::didChangePerformanceTiming()
200 { 201 {
201 if (frame() && frame()->isMainFrame() && m_state >= Committed) { 202 if (frame() && frame()->isMainFrame() && m_state >= Committed) {
202 frameLoader()->client()->didChangePerformanceTiming(); 203 frameLoader()->client()->didChangePerformanceTiming();
203 } 204 }
204 } 205 }
205 206
206 void DocumentLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDoc umentNavigationSource sameDocumentNavigationSource) 207 void DocumentLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDoc umentNavigationSource sameDocumentNavigationSource)
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 { 844 {
844 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing); 845 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing);
845 if (!source.isNull()) 846 if (!source.isNull())
846 m_writer->appendReplacingData(source); 847 m_writer->appendReplacingData(source);
847 endWriting(m_writer.get()); 848 endWriting(m_writer.get());
848 } 849 }
849 850
850 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 851 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
851 852
852 } // namespace blink 853 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698