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

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

Issue 2033293002: Implement StringImpl sharing for StringView::toString(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix preload scanner bug. Created 4 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
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 { 186 {
187 if (!m_tagImpl) 187 if (!m_tagImpl)
188 return; 188 return;
189 for (const CompactHTMLToken::Attribute& htmlTokenAttribute : attributes) 189 for (const CompactHTMLToken::Attribute& htmlTokenAttribute : attributes)
190 processAttribute(htmlTokenAttribute.name(), htmlTokenAttribute.value ()); 190 processAttribute(htmlTokenAttribute.name(), htmlTokenAttribute.value ());
191 } 191 }
192 192
193 void handlePictureSourceURL(PictureData& pictureData) 193 void handlePictureSourceURL(PictureData& pictureData)
194 { 194 {
195 if (match(m_tagImpl, sourceTag) && m_matched && pictureData.sourceURL.is Empty()) { 195 if (match(m_tagImpl, sourceTag) && m_matched && pictureData.sourceURL.is Empty()) {
196 pictureData.sourceURL = m_srcsetImageCandidate.toString(); 196 // Must create an isolatedCopy() since the srcset attribute value wi ll
197 // get sent back to the main thread between when we set this, and wh en we
198 // process the closing tag which would clear m_pictureData. Having a ny
199 // ref to a string we're going to send will fail isSafeToSendToAnoth erThread().
esprehn 2016/06/03 20:28:29 This was a bug that already existed, but StringVie
200 pictureData.sourceURL = m_srcsetImageCandidate.toString().isolatedCo py();
197 pictureData.sourceSizeSet = m_sourceSizeSet; 201 pictureData.sourceSizeSet = m_sourceSizeSet;
198 pictureData.sourceSize = m_sourceSize; 202 pictureData.sourceSize = m_sourceSize;
199 pictureData.picked = true; 203 pictureData.picked = true;
200 } else if (match(m_tagImpl, imgTag) && !pictureData.sourceURL.isEmpty()) { 204 } else if (match(m_tagImpl, imgTag) && !pictureData.sourceURL.isEmpty()) {
201 setUrlToLoad(pictureData.sourceURL, AllowURLReplacement); 205 setUrlToLoad(pictureData.sourceURL, AllowURLReplacement);
202 } 206 }
203 } 207 }
204 208
205 PassOwnPtr<PreloadRequest> createPreloadRequest(const KURL& predictedBaseURL , const SegmentedString& source, const ClientHintsPreferences& clientHintsPrefer ences, const PictureData& pictureData, const ReferrerPolicy documentReferrerPoli cy) 209 PassOwnPtr<PreloadRequest> createPreloadRequest(const KURL& predictedBaseURL , const SegmentedString& source, const ClientHintsPreferences& clientHintsPrefer ences, const PictureData& pictureData, const ReferrerPolicy documentReferrerPoli cy)
206 { 210 {
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 ASSERT(document); 808 ASSERT(document);
805 doHtmlPreloadScanning = !document->settings() || document->settings()->doHtm lPreloadScanning(); 809 doHtmlPreloadScanning = !document->settings() || document->settings()->doHtm lPreloadScanning();
806 doDocumentWritePreloadScanning = doHtmlPreloadScanning && document->frame() && document->frame()->isMainFrame(); 810 doDocumentWritePreloadScanning = doHtmlPreloadScanning && document->frame() && document->frame()->isMainFrame();
807 defaultViewportMinWidth = document->viewportDefaultMinWidth(); 811 defaultViewportMinWidth = document->viewportDefaultMinWidth();
808 viewportMetaZeroValuesQuirk = document->settings() && document->settings()-> viewportMetaZeroValuesQuirk(); 812 viewportMetaZeroValuesQuirk = document->settings() && document->settings()-> viewportMetaZeroValuesQuirk();
809 viewportMetaEnabled = document->settings() && document->settings()->viewport MetaEnabled(); 813 viewportMetaEnabled = document->settings() && document->settings()->viewport MetaEnabled();
810 referrerPolicy = document->getReferrerPolicy(); 814 referrerPolicy = document->getReferrerPolicy();
811 } 815 }
812 816
813 } // namespace blink 817 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/text/StringBuilder.h » ('j') | third_party/WebKit/Source/wtf/text/StringBuilder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698