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

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

Issue 2676163002: Refactor the forPreload flag to mean speculative preload. (Closed)
Patch Set: Renamed ReportingPolicy and moved comments Created 3 years, 10 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 | « no previous file | third_party/WebKit/Source/core/html/parser/PreloadRequest.cpp » ('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, 2010 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 2010 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 91 }
92 92
93 void CSSPreloadScanner::setReferrerPolicy(const ReferrerPolicy policy) { 93 void CSSPreloadScanner::setReferrerPolicy(const ReferrerPolicy policy) {
94 m_referrerPolicy = policy; 94 m_referrerPolicy = policy;
95 } 95 }
96 96
97 inline void CSSPreloadScanner::tokenize(UChar c, 97 inline void CSSPreloadScanner::tokenize(UChar c,
98 const SegmentedString& source) { 98 const SegmentedString& source) {
99 // We are just interested in @import rules, no need for real tokenization here 99 // We are just interested in @import rules, no need for real tokenization here
100 // Searching for other types of resources is probably low payoff. 100 // Searching for other types of resources is probably low payoff.
101 // If we ever decide to preload fonts, we also need to change
102 // ResourceFetcher::resourceNeedsLoad to immediately load speculative font
103 // preloads.
101 switch (m_state) { 104 switch (m_state) {
102 case Initial: 105 case Initial:
103 if (isHTMLSpace<UChar>(c)) 106 if (isHTMLSpace<UChar>(c))
104 break; 107 break;
105 if (c == '@') 108 if (c == '@')
106 m_state = RuleStart; 109 m_state = RuleStart;
107 else if (c == '/') 110 else if (c == '/')
108 m_state = MaybeComment; 111 m_state = MaybeComment;
109 else 112 else
110 m_state = DoneParsingImportRules; 113 m_state = DoneParsingImportRules;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 m_resource.clear(); 346 m_resource.clear();
344 } 347 }
345 348
346 DEFINE_TRACE(CSSPreloaderResourceClient) { 349 DEFINE_TRACE(CSSPreloaderResourceClient) {
347 visitor->trace(m_preloader); 350 visitor->trace(m_preloader);
348 visitor->trace(m_resource); 351 visitor->trace(m_resource);
349 StyleSheetResourceClient::trace(visitor); 352 StyleSheetResourceClient::trace(visitor);
350 } 353 }
351 354
352 } // namespace blink 355 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/PreloadRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698