| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 USING_FAST_MALLOC(BackgroundHTMLParser); | 49 USING_FAST_MALLOC(BackgroundHTMLParser); |
| 50 WTF_MAKE_NONCOPYABLE(BackgroundHTMLParser); | 50 WTF_MAKE_NONCOPYABLE(BackgroundHTMLParser); |
| 51 public: | 51 public: |
| 52 struct Configuration { | 52 struct Configuration { |
| 53 USING_FAST_MALLOC(Configuration); | 53 USING_FAST_MALLOC(Configuration); |
| 54 public: | 54 public: |
| 55 Configuration(); | 55 Configuration(); |
| 56 HTMLParserOptions options; | 56 HTMLParserOptions options; |
| 57 WeakPtr<HTMLDocumentParser> parser; | 57 WeakPtr<HTMLDocumentParser> parser; |
| 58 OwnPtr<XSSAuditor> xssAuditor; | 58 OwnPtr<XSSAuditor> xssAuditor; |
| 59 OwnPtr<TokenPreloadScanner> preloadScanner; | |
| 60 OwnPtr<TextResourceDecoder> decoder; | 59 OwnPtr<TextResourceDecoder> decoder; |
| 61 RefPtr<ParsedChunkQueue> parsedChunkQueue; | 60 RefPtr<ParsedChunkQueue> parsedChunkQueue; |
| 62 // outstandingTokenLimit must be greater than or equal to | 61 // outstandingTokenLimit must be greater than or equal to |
| 63 // pendingTokenLimit | 62 // pendingTokenLimit |
| 64 size_t outstandingTokenLimit; | 63 size_t outstandingTokenLimit; |
| 65 size_t pendingTokenLimit; | 64 size_t pendingTokenLimit; |
| 66 }; | 65 }; |
| 67 | 66 |
| 68 static void start(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOwnPt
r<Configuration>, PassOwnPtr<WebTaskRunner>); | 67 static void start(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOwnPt
r<Configuration>, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters>,
const MediaValuesCached::MediaValuesCachedData&, PassOwnPtr<WebTaskRunner>); |
| 69 | 68 |
| 70 struct Checkpoint { | 69 struct Checkpoint { |
| 71 USING_FAST_MALLOC(Checkpoint); | 70 USING_FAST_MALLOC(Checkpoint); |
| 72 public: | 71 public: |
| 73 WeakPtr<HTMLDocumentParser> parser; | 72 WeakPtr<HTMLDocumentParser> parser; |
| 74 OwnPtr<HTMLToken> token; | 73 OwnPtr<HTMLToken> token; |
| 75 OwnPtr<HTMLTokenizer> tokenizer; | 74 OwnPtr<HTMLTokenizer> tokenizer; |
| 76 HTMLTreeBuilderSimulator::State treeBuilderState; | 75 HTMLTreeBuilderSimulator::State treeBuilderState; |
| 77 HTMLInputCheckpoint inputCheckpoint; | 76 HTMLInputCheckpoint inputCheckpoint; |
| 78 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; | 77 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; |
| 79 String unparsedInput; | 78 String unparsedInput; |
| 80 }; | 79 }; |
| 81 | 80 |
| 82 void appendRawBytesFromParserThread(const char* data, int dataLength); | 81 void appendRawBytesFromParserThread(const char* data, int dataLength); |
| 83 | 82 |
| 84 void appendRawBytesFromMainThread(PassOwnPtr<Vector<char>>); | 83 void appendRawBytesFromMainThread(PassOwnPtr<Vector<char>>); |
| 85 void setDecoder(PassOwnPtr<TextResourceDecoder>); | 84 void setDecoder(PassOwnPtr<TextResourceDecoder>); |
| 86 void flush(); | 85 void flush(); |
| 87 void resumeFrom(PassOwnPtr<Checkpoint>); | 86 void resumeFrom(PassOwnPtr<Checkpoint>); |
| 88 void startedChunkWithCheckpoint(HTMLInputCheckpoint); | 87 void startedChunkWithCheckpoint(HTMLInputCheckpoint); |
| 89 void finish(); | 88 void finish(); |
| 90 void stop(); | 89 void stop(); |
| 91 | 90 |
| 92 void forcePlaintextForTextDocument(); | 91 void forcePlaintextForTextDocument(); |
| 93 | 92 |
| 94 private: | 93 private: |
| 95 BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOw
nPtr<Configuration>, PassOwnPtr<WebTaskRunner>); | 94 BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOw
nPtr<Configuration>, const KURL& documentURL, PassOwnPtr<CachedDocumentParameter
s>, const MediaValuesCached::MediaValuesCachedData&, PassOwnPtr<WebTaskRunner>); |
| 96 ~BackgroundHTMLParser(); | 95 ~BackgroundHTMLParser(); |
| 97 | 96 |
| 98 void appendDecodedBytes(const String&); | 97 void appendDecodedBytes(const String&); |
| 99 void markEndOfFile(); | 98 void markEndOfFile(); |
| 100 void pumpTokenizer(); | 99 void pumpTokenizer(); |
| 101 void sendTokensToMainThread(); | 100 void sendTokensToMainThread(); |
| 102 void updateDocument(const String& decodedData); | 101 void updateDocument(const String& decodedData); |
| 103 | 102 |
| 104 WeakPtrFactory<BackgroundHTMLParser> m_weakFactory; | 103 WeakPtrFactory<BackgroundHTMLParser> m_weakFactory; |
| 105 BackgroundHTMLInputStream m_input; | 104 BackgroundHTMLInputStream m_input; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 122 DocumentEncodingData m_lastSeenEncodingData; | 121 DocumentEncodingData m_lastSeenEncodingData; |
| 123 OwnPtr<WebTaskRunner> m_loadingTaskRunner; | 122 OwnPtr<WebTaskRunner> m_loadingTaskRunner; |
| 124 RefPtr<ParsedChunkQueue> m_parsedChunkQueue; | 123 RefPtr<ParsedChunkQueue> m_parsedChunkQueue; |
| 125 | 124 |
| 126 bool m_startingScript; | 125 bool m_startingScript; |
| 127 }; | 126 }; |
| 128 | 127 |
| 129 } // namespace blink | 128 } // namespace blink |
| 130 | 129 |
| 131 #endif | 130 #endif |
| OLD | NEW |