Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 PreloadRequestStream preloads; | 106 PreloadRequestStream preloads; |
| 107 ViewportDescriptionWrapper viewport; | 107 ViewportDescriptionWrapper viewport; |
| 108 XSSInfoStream xssInfos; | 108 XSSInfoStream xssInfos; |
| 109 HTMLTokenizer::State tokenizerState; | 109 HTMLTokenizer::State tokenizerState; |
| 110 HTMLTreeBuilderSimulator::State treeBuilderState; | 110 HTMLTreeBuilderSimulator::State treeBuilderState; |
| 111 HTMLInputCheckpoint inputCheckpoint; | 111 HTMLInputCheckpoint inputCheckpoint; |
| 112 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; | 112 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; |
| 113 bool startingScript; | 113 bool startingScript; |
| 114 // Indices into |tokens|. | 114 // Indices into |tokens|. |
| 115 Vector<int> likelyDocumentWriteScriptIndices; | 115 Vector<int> likelyDocumentWriteScriptIndices; |
| 116 // Raw pointer into the last <meta> csp tag in |tokens|. Preloads will | |
| 117 // be deferred until this token is parsed. | |
| 118 CompactHTMLToken* pendingCSPMetaTag; | |
|
kouhei (in TOK)
2016/08/19 04:56:15
Let's use index as in "likelyDocumentWriteScriptIn
Charlie Harrison
2016/08/19 12:33:33
SGTM but we'll have to pull the pointer out when t
kouhei (in TOK)
2016/08/22 05:34:03
I'm thinking of keeping a defer counter on the mai
Charlie Harrison
2016/08/22 14:08:05
Do you mean a followup? I'd be happy to implement
kouhei (in TOK)
2016/08/23 02:18:39
I mean a follow up. I'm not sure if its really pos
| |
| 116 }; | 119 }; |
| 117 void notifyPendingTokenizedChunks(); | 120 void notifyPendingTokenizedChunks(); |
| 118 void didReceiveEncodingDataFromBackgroundParser(const DocumentEncodingData&) ; | 121 void didReceiveEncodingDataFromBackgroundParser(const DocumentEncodingData&) ; |
| 119 | 122 |
| 120 void appendBytes(const char* bytes, size_t length) override; | 123 void appendBytes(const char* bytes, size_t length) override; |
| 121 void flush() final; | 124 void flush() final; |
| 122 void setDecoder(std::unique_ptr<TextResourceDecoder>) final; | 125 void setDecoder(std::unique_ptr<TextResourceDecoder>) final; |
| 123 | 126 |
| 124 protected: | 127 protected: |
| 125 void insert(const SegmentedString&) final; | 128 void insert(const SegmentedString&) final; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 | 182 |
| 180 bool shouldUseThreading() const { return m_shouldUseThreading; } | 183 bool shouldUseThreading() const { return m_shouldUseThreading; } |
| 181 | 184 |
| 182 bool isParsingFragment() const; | 185 bool isParsingFragment() const; |
| 183 bool isScheduledForResume() const; | 186 bool isScheduledForResume() const; |
| 184 bool inPumpSession() const { return m_pumpSessionNestingLevel > 0; } | 187 bool inPumpSession() const { return m_pumpSessionNestingLevel > 0; } |
| 185 bool shouldDelayEnd() const { return inPumpSession() || isWaitingForScripts( ) || isScheduledForResume() || isExecutingScript(); } | 188 bool shouldDelayEnd() const { return inPumpSession() || isWaitingForScripts( ) || isScheduledForResume() || isExecutingScript(); } |
| 186 | 189 |
| 187 std::unique_ptr<HTMLPreloadScanner> createPreloadScanner(); | 190 std::unique_ptr<HTMLPreloadScanner> createPreloadScanner(); |
| 188 | 191 |
| 189 int preloadInsertion(const SegmentedString& source); | 192 void fetchQueuedPreloads(); |
| 193 | |
| 190 void evaluateAndPreloadScriptForDocumentWrite(const String& source); | 194 void evaluateAndPreloadScriptForDocumentWrite(const String& source); |
| 191 | 195 |
| 192 // Temporary enum for the ParseHTMLOnMainThread experiment. This is used to | 196 // Temporary enum for the ParseHTMLOnMainThread experiment. This is used to |
| 193 // annotate whether a given task should post a task or not on the main | 197 // annotate whether a given task should post a task or not on the main |
| 194 // thread if the lookahead parser is living on the main thread. | 198 // thread if the lookahead parser is living on the main thread. |
| 195 enum LookaheadParserTaskSynchrony { | 199 enum LookaheadParserTaskSynchrony { |
| 196 Synchronous, | 200 Synchronous, |
| 197 Asynchronous, | 201 Asynchronous, |
| 198 }; | 202 }; |
| 199 | 203 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 228 std::unique_ptr<TokenizedChunk> m_lastChunkBeforeScript; | 232 std::unique_ptr<TokenizedChunk> m_lastChunkBeforeScript; |
| 229 Deque<std::unique_ptr<TokenizedChunk>> m_speculations; | 233 Deque<std::unique_ptr<TokenizedChunk>> m_speculations; |
| 230 WeakPtrFactory<HTMLDocumentParser> m_weakFactory; | 234 WeakPtrFactory<HTMLDocumentParser> m_weakFactory; |
| 231 WeakPtr<BackgroundHTMLParser> m_backgroundParser; | 235 WeakPtr<BackgroundHTMLParser> m_backgroundParser; |
| 232 Member<HTMLResourcePreloader> m_preloader; | 236 Member<HTMLResourcePreloader> m_preloader; |
| 233 PreloadRequestStream m_queuedPreloads; | 237 PreloadRequestStream m_queuedPreloads; |
| 234 Vector<String> m_queuedDocumentWriteScripts; | 238 Vector<String> m_queuedDocumentWriteScripts; |
| 235 RefPtr<TokenizedChunkQueue> m_tokenizedChunkQueue; | 239 RefPtr<TokenizedChunkQueue> m_tokenizedChunkQueue; |
| 236 std::unique_ptr<DocumentWriteEvaluator> m_evaluator; | 240 std::unique_ptr<DocumentWriteEvaluator> m_evaluator; |
| 237 | 241 |
| 242 CompactHTMLToken* m_pendingCSPMetaTag; | |
| 243 | |
| 238 bool m_shouldUseThreading; | 244 bool m_shouldUseThreading; |
| 239 bool m_endWasDelayed; | 245 bool m_endWasDelayed; |
| 240 bool m_haveBackgroundParser; | 246 bool m_haveBackgroundParser; |
| 241 bool m_tasksWereSuspended; | 247 bool m_tasksWereSuspended; |
| 242 unsigned m_pumpSessionNestingLevel; | 248 unsigned m_pumpSessionNestingLevel; |
| 243 unsigned m_pumpSpeculationsSessionNestingLevel; | 249 unsigned m_pumpSpeculationsSessionNestingLevel; |
| 244 bool m_isParsingAtLineNumber; | 250 bool m_isParsingAtLineNumber; |
| 245 bool m_triedLoadingLinkHeaders; | 251 bool m_triedLoadingLinkHeaders; |
| 246 }; | 252 }; |
| 247 | 253 |
| 248 } // namespace blink | 254 } // namespace blink |
| 249 | 255 |
| 250 #endif | 256 #endif |
| OLD | NEW |