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

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

Issue 2583233002: Migrate WTF::Vector::append() to ::push_back() [part 7 of N] (Closed)
Patch Set: Created 3 years, 12 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 DCHECK(m_documentParameters.get()); 544 DCHECK(m_documentParameters.get());
545 DCHECK(m_mediaValues.get()); 545 DCHECK(m_mediaValues.get());
546 DCHECK(documentURL.isValid()); 546 DCHECK(documentURL.isValid());
547 m_cssScanner.setReferrerPolicy(m_documentParameters->referrerPolicy); 547 m_cssScanner.setReferrerPolicy(m_documentParameters->referrerPolicy);
548 } 548 }
549 549
550 TokenPreloadScanner::~TokenPreloadScanner() {} 550 TokenPreloadScanner::~TokenPreloadScanner() {}
551 551
552 TokenPreloadScannerCheckpoint TokenPreloadScanner::createCheckpoint() { 552 TokenPreloadScannerCheckpoint TokenPreloadScanner::createCheckpoint() {
553 TokenPreloadScannerCheckpoint checkpoint = m_checkpoints.size(); 553 TokenPreloadScannerCheckpoint checkpoint = m_checkpoints.size();
554 m_checkpoints.append(Checkpoint(m_predictedBaseElementURL, m_inStyle, 554 m_checkpoints.push_back(Checkpoint(m_predictedBaseElementURL, m_inStyle,
555 m_inScript, m_templateCount)); 555 m_inScript, m_templateCount));
556 return checkpoint; 556 return checkpoint;
557 } 557 }
558 558
559 void TokenPreloadScanner::rewindTo( 559 void TokenPreloadScanner::rewindTo(
560 TokenPreloadScannerCheckpoint checkpointIndex) { 560 TokenPreloadScannerCheckpoint checkpointIndex) {
561 // If this ASSERT fires, checkpointIndex is invalid. 561 // If this ASSERT fires, checkpointIndex is invalid.
562 ASSERT(checkpointIndex < m_checkpoints.size()); 562 ASSERT(checkpointIndex < m_checkpoints.size());
563 const Checkpoint& checkpoint = m_checkpoints[checkpointIndex]; 563 const Checkpoint& checkpoint = m_checkpoints[checkpointIndex];
564 m_predictedBaseElementURL = checkpoint.predictedBaseElementURL; 564 m_predictedBaseElementURL = checkpoint.predictedBaseElementURL;
565 m_inStyle = checkpoint.inStyle; 565 m_inStyle = checkpoint.inStyle;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 scanner.processAttributes(token.attributes()); 808 scanner.processAttributes(token.attributes());
809 // TODO(yoav): ViewportWidth is currently racy and might be zero in some 809 // TODO(yoav): ViewportWidth is currently racy and might be zero in some
810 // cases, at least in tests. That problem will go away once 810 // cases, at least in tests. That problem will go away once
811 // ParseHTMLOnMainThread lands and MediaValuesCached is eliminated. 811 // ParseHTMLOnMainThread lands and MediaValuesCached is eliminated.
812 if (m_inPicture && m_mediaValues->viewportWidth()) 812 if (m_inPicture && m_mediaValues->viewportWidth())
813 scanner.handlePictureSourceURL(m_pictureData); 813 scanner.handlePictureSourceURL(m_pictureData);
814 std::unique_ptr<PreloadRequest> request = scanner.createPreloadRequest( 814 std::unique_ptr<PreloadRequest> request = scanner.createPreloadRequest(
815 m_predictedBaseElementURL, source, m_clientHintsPreferences, 815 m_predictedBaseElementURL, source, m_clientHintsPreferences,
816 m_pictureData, m_documentParameters->referrerPolicy); 816 m_pictureData, m_documentParameters->referrerPolicy);
817 if (request) 817 if (request)
818 requests.append(std::move(request)); 818 requests.push_back(std::move(request));
819 return; 819 return;
820 } 820 }
821 default: { return; } 821 default: { return; }
822 } 822 }
823 } 823 }
824 824
825 template <typename Token> 825 template <typename Token>
826 void TokenPreloadScanner::updatePredictedBaseURL(const Token& token) { 826 void TokenPreloadScanner::updatePredictedBaseURL(const Token& token) {
827 ASSERT(m_predictedBaseElementURL.isEmpty()); 827 ASSERT(m_predictedBaseElementURL.isEmpty());
828 if (const typename Token::Attribute* hrefAttribute = 828 if (const typename Token::Attribute* hrefAttribute =
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 defaultViewportMinWidth = document->viewportDefaultMinWidth(); 892 defaultViewportMinWidth = document->viewportDefaultMinWidth();
893 viewportMetaZeroValuesQuirk = 893 viewportMetaZeroValuesQuirk =
894 document->settings() && 894 document->settings() &&
895 document->settings()->viewportMetaZeroValuesQuirk(); 895 document->settings()->viewportMetaZeroValuesQuirk();
896 viewportMetaEnabled = 896 viewportMetaEnabled =
897 document->settings() && document->settings()->viewportMetaEnabled(); 897 document->settings() && document->settings()->viewportMetaEnabled();
898 referrerPolicy = document->getReferrerPolicy(); 898 referrerPolicy = document->getReferrerPolicy();
899 } 899 }
900 900
901 } // namespace blink 901 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698