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

Side by Side Diff: Source/core/html/parser/HTMLPreloadScanner.cpp

Issue 1078633003: Added preloader support for sizes based RW values (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 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
« no previous file with comments | « Source/core/fetch/FetchRequest.cpp ('k') | Source/core/html/parser/HTMLResourcePreloader.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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/
4 * Copyright (C) 2010 Google Inc. All Rights Reserved. 4 * Copyright (C) 2010 Google Inc. All Rights Reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 else if (match(m_tagImpl, imgTag) && !sourceURL.isEmpty()) 161 else if (match(m_tagImpl, imgTag) && !sourceURL.isEmpty())
162 setUrlToLoad(sourceURL, AllowURLReplacement); 162 setUrlToLoad(sourceURL, AllowURLReplacement);
163 } 163 }
164 164
165 PassOwnPtr<PreloadRequest> createPreloadRequest(const KURL& predictedBaseURL , const SegmentedString& source) 165 PassOwnPtr<PreloadRequest> createPreloadRequest(const KURL& predictedBaseURL , const SegmentedString& source)
166 { 166 {
167 if (!shouldPreload() || !m_matchedMediaAttribute) 167 if (!shouldPreload() || !m_matchedMediaAttribute)
168 return nullptr; 168 return nullptr;
169 169
170 TextPosition position = TextPosition(source.currentLine(), source.curren tColumn()); 170 TextPosition position = TextPosition(source.currentLine(), source.curren tColumn());
171 OwnPtr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_t agImpl), position, m_urlToLoad, predictedBaseURL, resourceType()); 171 FetchRequest::ResourceWidth resourceWidth;
172 if (m_sourceSizeSet) {
173 resourceWidth.width = m_sourceSize;
174 resourceWidth.isSet = true;
175 }
176 OwnPtr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_t agImpl), position, m_urlToLoad, predictedBaseURL, resourceType(), resourceWidth) ;
172 if (isCORSEnabled()) 177 if (isCORSEnabled())
173 request->setCrossOriginEnabled(allowStoredCredentials()); 178 request->setCrossOriginEnabled(allowStoredCredentials());
174 request->setCharset(charset()); 179 request->setCharset(charset());
175 request->setDefer(m_defer); 180 request->setDefer(m_defer);
176 return request.release(); 181 return request.release();
177 } 182 }
178 183
179 private: 184 private:
180 template<typename NameType> 185 template<typename NameType>
181 void processScriptAttribute(const NameType& attributeName, const String& att ributeValue) 186 void processScriptAttribute(const NameType& attributeName, const String& att ributeValue)
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 if (m_token.type() == HTMLToken::StartTag) 557 if (m_token.type() == HTMLToken::StartTag)
553 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name (), Likely8Bit)); 558 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name (), Likely8Bit));
554 m_scanner.scan(m_token, m_source, requests); 559 m_scanner.scan(m_token, m_source, requests);
555 m_token.clear(); 560 m_token.clear();
556 } 561 }
557 562
558 preloader->takeAndPreload(requests); 563 preloader->takeAndPreload(requests);
559 } 564 }
560 565
561 } 566 }
OLDNEW
« no previous file with comments | « Source/core/fetch/FetchRequest.cpp ('k') | Source/core/html/parser/HTMLResourcePreloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698