| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2013 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 std::unique_ptr<XSSAuditor> xssAuditor; | 58 std::unique_ptr<XSSAuditor> xssAuditor; |
| 59 std::unique_ptr<TextResourceDecoder> decoder; | 59 std::unique_ptr<TextResourceDecoder> decoder; |
| 60 RefPtr<TokenizedChunkQueue> tokenizedChunkQueue; | 60 RefPtr<TokenizedChunkQueue> tokenizedChunkQueue; |
| 61 // outstandingTokenLimit must be greater than or equal to | 61 // outstandingTokenLimit must be greater than or equal to |
| 62 // pendingTokenLimit | 62 // pendingTokenLimit |
| 63 size_t outstandingTokenLimit; | 63 size_t outstandingTokenLimit; |
| 64 size_t pendingTokenLimit; | 64 size_t pendingTokenLimit; |
| 65 bool shouldCoalesceChunks; | 65 bool shouldCoalesceChunks; |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 static void start(PassRefPtr<WeakReference<BackgroundHTMLParser>>, std::uniq
ue_ptr<Configuration>, const KURL& documentURL, std::unique_ptr<CachedDocumentPa
rameters>, const MediaValuesCached::MediaValuesCachedData&, std::unique_ptr<WebT
askRunner>); | 68 // The returned BackgroundHTMLParser should only be used on the parser |
| 69 // thread: it must first be initialized by calling init(), and free by |
| 70 // calling stop(). |
| 71 static WeakPtr<BackgroundHTMLParser> create(std::unique_ptr<Configuration>,
std::unique_ptr<WebTaskRunner>); |
| 72 void init(const KURL& documentURL, std::unique_ptr<CachedDocumentParameters>
, const MediaValuesCached::MediaValuesCachedData&); |
| 69 | 73 |
| 70 struct Checkpoint { | 74 struct Checkpoint { |
| 71 USING_FAST_MALLOC(Checkpoint); | 75 USING_FAST_MALLOC(Checkpoint); |
| 72 public: | 76 public: |
| 73 WeakPtr<HTMLDocumentParser> parser; | 77 WeakPtr<HTMLDocumentParser> parser; |
| 74 std::unique_ptr<HTMLToken> token; | 78 std::unique_ptr<HTMLToken> token; |
| 75 std::unique_ptr<HTMLTokenizer> tokenizer; | 79 std::unique_ptr<HTMLTokenizer> tokenizer; |
| 76 HTMLTreeBuilderSimulator::State treeBuilderState; | 80 HTMLTreeBuilderSimulator::State treeBuilderState; |
| 77 HTMLInputCheckpoint inputCheckpoint; | 81 HTMLInputCheckpoint inputCheckpoint; |
| 78 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; | 82 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; |
| 79 String unparsedInput; | 83 String unparsedInput; |
| 80 }; | 84 }; |
| 81 | 85 |
| 82 void appendRawBytesFromMainThread(std::unique_ptr<Vector<char>>, double byte
sReceivedTime); | 86 void appendRawBytesFromMainThread(std::unique_ptr<Vector<char>>, double byte
sReceivedTime); |
| 83 void setDecoder(std::unique_ptr<TextResourceDecoder>); | 87 void setDecoder(std::unique_ptr<TextResourceDecoder>); |
| 84 void flush(); | 88 void flush(); |
| 85 void resumeFrom(std::unique_ptr<Checkpoint>); | 89 void resumeFrom(std::unique_ptr<Checkpoint>); |
| 86 void startedChunkWithCheckpoint(HTMLInputCheckpoint); | 90 void startedChunkWithCheckpoint(HTMLInputCheckpoint); |
| 87 void finish(); | 91 void finish(); |
| 88 void stop(); | 92 void stop(); |
| 89 | 93 |
| 90 void forcePlaintextForTextDocument(); | 94 void forcePlaintextForTextDocument(); |
| 91 | 95 |
| 92 private: | 96 private: |
| 93 BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>>, std::u
nique_ptr<Configuration>, const KURL& documentURL, std::unique_ptr<CachedDocumen
tParameters>, const MediaValuesCached::MediaValuesCachedData&, std::unique_ptr<W
ebTaskRunner>); | 97 BackgroundHTMLParser(std::unique_ptr<Configuration>, std::unique_ptr<WebTask
Runner>); |
| 94 ~BackgroundHTMLParser(); | 98 ~BackgroundHTMLParser(); |
| 95 | 99 |
| 96 void appendDecodedBytes(const String&); | 100 void appendDecodedBytes(const String&); |
| 97 void markEndOfFile(); | 101 void markEndOfFile(); |
| 98 void pumpTokenizer(); | 102 void pumpTokenizer(); |
| 99 | 103 |
| 100 // Returns whether or not the HTMLDocumentParser should be notified of | 104 // Returns whether or not the HTMLDocumentParser should be notified of |
| 101 // pending chunks. | 105 // pending chunks. |
| 102 bool queueChunkForMainThread(); | 106 bool queueChunkForMainThread(); |
| 103 void notifyMainThreadOfNewChunks(); | 107 void notifyMainThreadOfNewChunks(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 int m_pendingCSPMetaTokenIndex; | 140 int m_pendingCSPMetaTokenIndex; |
| 137 | 141 |
| 138 bool m_startingScript; | 142 bool m_startingScript; |
| 139 double m_lastBytesReceivedTime; | 143 double m_lastBytesReceivedTime; |
| 140 bool m_shouldCoalesceChunks; | 144 bool m_shouldCoalesceChunks; |
| 141 }; | 145 }; |
| 142 | 146 |
| 143 } // namespace blink | 147 } // namespace blink |
| 144 | 148 |
| 145 #endif | 149 #endif |
| OLD | NEW |