OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2010 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2010 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 private: | 75 private: |
76 explicit CachedDocumentParameters(Document*); | 76 explicit CachedDocumentParameters(Document*); |
77 CachedDocumentParameters() = default; | 77 CachedDocumentParameters() = default; |
78 }; | 78 }; |
79 | 79 |
80 class TokenPreloadScanner { | 80 class TokenPreloadScanner { |
81 WTF_MAKE_NONCOPYABLE(TokenPreloadScanner); | 81 WTF_MAKE_NONCOPYABLE(TokenPreloadScanner); |
82 USING_FAST_MALLOC(TokenPreloadScanner); | 82 USING_FAST_MALLOC(TokenPreloadScanner); |
83 | 83 |
84 public: | 84 public: |
85 enum ScannerType { kMainDocumentScanner = 0, kInsertionScanner }; | |
kinuko
2017/04/21 06:22:25
nit: enum class, and name each enum names shorter?
Pat Meenan
2017/04/21 16:11:02
Done.
| |
86 | |
85 TokenPreloadScanner(const KURL& document_url, | 87 TokenPreloadScanner(const KURL& document_url, |
86 std::unique_ptr<CachedDocumentParameters>, | 88 std::unique_ptr<CachedDocumentParameters>, |
87 const MediaValuesCached::MediaValuesCachedData&); | 89 const MediaValuesCached::MediaValuesCachedData&, |
90 const ScannerType); | |
88 ~TokenPreloadScanner(); | 91 ~TokenPreloadScanner(); |
89 | 92 |
90 void Scan(const HTMLToken&, | 93 void Scan(const HTMLToken&, |
91 const SegmentedString&, | 94 const SegmentedString&, |
92 PreloadRequestStream& requests, | 95 PreloadRequestStream& requests, |
93 ViewportDescriptionWrapper*, | 96 ViewportDescriptionWrapper*, |
94 bool* is_csp_meta_tag); | 97 bool* is_csp_meta_tag); |
95 void Scan(const CompactHTMLToken&, | 98 void Scan(const CompactHTMLToken&, |
96 const SegmentedString&, | 99 const SegmentedString&, |
97 PreloadRequestStream& requests, | 100 PreloadRequestStream& requests, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 const KURL document_url_; | 158 const KURL document_url_; |
156 KURL predicted_base_element_url_; | 159 KURL predicted_base_element_url_; |
157 bool in_style_; | 160 bool in_style_; |
158 bool in_picture_; | 161 bool in_picture_; |
159 bool in_script_; | 162 bool in_script_; |
160 PictureData picture_data_; | 163 PictureData picture_data_; |
161 size_t template_count_; | 164 size_t template_count_; |
162 std::unique_ptr<CachedDocumentParameters> document_parameters_; | 165 std::unique_ptr<CachedDocumentParameters> document_parameters_; |
163 Persistent<MediaValuesCached> media_values_; | 166 Persistent<MediaValuesCached> media_values_; |
164 ClientHintsPreferences client_hints_preferences_; | 167 ClientHintsPreferences client_hints_preferences_; |
168 ScannerType scanner_type_; | |
165 | 169 |
166 bool did_rewind_ = false; | 170 bool did_rewind_ = false; |
167 | 171 |
168 Vector<Checkpoint> checkpoints_; | 172 Vector<Checkpoint> checkpoints_; |
169 }; | 173 }; |
170 | 174 |
171 class CORE_EXPORT HTMLPreloadScanner { | 175 class CORE_EXPORT HTMLPreloadScanner { |
172 WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); | 176 WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); |
173 USING_FAST_MALLOC(HTMLPreloadScanner); | 177 USING_FAST_MALLOC(HTMLPreloadScanner); |
174 | 178 |
175 public: | 179 public: |
176 static std::unique_ptr<HTMLPreloadScanner> Create( | 180 static std::unique_ptr<HTMLPreloadScanner> Create( |
177 const HTMLParserOptions& options, | 181 const HTMLParserOptions& options, |
178 const KURL& document_url, | 182 const KURL& document_url, |
179 std::unique_ptr<CachedDocumentParameters> document_parameters, | 183 std::unique_ptr<CachedDocumentParameters> document_parameters, |
180 const MediaValuesCached::MediaValuesCachedData& | 184 const MediaValuesCached::MediaValuesCachedData& media_values_cached_data, |
181 media_values_cached_data) { | 185 const TokenPreloadScanner::ScannerType scanner_type) { |
182 return WTF::WrapUnique(new HTMLPreloadScanner( | 186 return WTF::WrapUnique(new HTMLPreloadScanner( |
183 options, document_url, std::move(document_parameters), | 187 options, document_url, std::move(document_parameters), |
184 media_values_cached_data)); | 188 media_values_cached_data, scanner_type)); |
185 } | 189 } |
186 | 190 |
187 ~HTMLPreloadScanner(); | 191 ~HTMLPreloadScanner(); |
188 | 192 |
189 void AppendToEnd(const SegmentedString&); | 193 void AppendToEnd(const SegmentedString&); |
190 PreloadRequestStream Scan(const KURL& document_base_element_url, | 194 PreloadRequestStream Scan(const KURL& document_base_element_url, |
191 ViewportDescriptionWrapper*); | 195 ViewportDescriptionWrapper*); |
192 | 196 |
193 private: | 197 private: |
194 HTMLPreloadScanner(const HTMLParserOptions&, | 198 HTMLPreloadScanner(const HTMLParserOptions&, |
195 const KURL& document_url, | 199 const KURL& document_url, |
196 std::unique_ptr<CachedDocumentParameters>, | 200 std::unique_ptr<CachedDocumentParameters>, |
197 const MediaValuesCached::MediaValuesCachedData&); | 201 const MediaValuesCached::MediaValuesCachedData&, |
202 const TokenPreloadScanner::ScannerType); | |
198 | 203 |
199 TokenPreloadScanner scanner_; | 204 TokenPreloadScanner scanner_; |
200 SegmentedString source_; | 205 SegmentedString source_; |
201 HTMLToken token_; | 206 HTMLToken token_; |
202 std::unique_ptr<HTMLTokenizer> tokenizer_; | 207 std::unique_ptr<HTMLTokenizer> tokenizer_; |
203 }; | 208 }; |
204 | 209 |
205 } // namespace blink | 210 } // namespace blink |
206 | 211 |
207 #endif | 212 #endif |
OLD | NEW |