| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 class BackgroundHTMLParser { | 43 class BackgroundHTMLParser { |
| 44 WTF_MAKE_FAST_ALLOCATED; | 44 WTF_MAKE_FAST_ALLOCATED; |
| 45 public: | 45 public: |
| 46 struct Configuration { | 46 struct Configuration { |
| 47 HTMLParserOptions options; | 47 HTMLParserOptions options; |
| 48 WeakPtr<HTMLDocumentParser> parser; | 48 WeakPtr<HTMLDocumentParser> parser; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 static base::WeakPtr<BackgroundHTMLParser> create(PassOwnPtr<Configuration>)
; | 51 static base::WeakPtr<BackgroundHTMLParser> create(PassOwnPtr<Configuration>)
; |
| 52 | 52 |
| 53 struct Checkpoint { | |
| 54 WeakPtr<HTMLDocumentParser> parser; | |
| 55 OwnPtr<HTMLToken> token; | |
| 56 OwnPtr<HTMLTokenizer> tokenizer; | |
| 57 String unparsedInput; | |
| 58 }; | |
| 59 | |
| 60 void appendRawBytesFromParserThread(const char* data, int dataLength); | |
| 61 | |
| 62 void appendRawBytesFromMainThread(PassOwnPtr<Vector<char> >); | 53 void appendRawBytesFromMainThread(PassOwnPtr<Vector<char> >); |
| 63 void flush(); | 54 void flush(); |
| 64 void resumeFrom(PassOwnPtr<Checkpoint>); | |
| 65 void finish(); | 55 void finish(); |
| 66 void stop(); | 56 void stop(); |
| 67 | 57 |
| 68 private: | 58 private: |
| 69 explicit BackgroundHTMLParser(PassOwnPtr<Configuration>); | 59 explicit BackgroundHTMLParser(PassOwnPtr<Configuration>); |
| 70 ~BackgroundHTMLParser(); | 60 ~BackgroundHTMLParser(); |
| 71 | 61 |
| 72 void appendDecodedBytes(const String&); | 62 void appendDecodedBytes(const String&); |
| 73 void markEndOfFile(); | 63 void markEndOfFile(); |
| 74 void pumpTokenizer(); | 64 void pumpTokenizer(); |
| 75 void sendTokensToMainThread(); | 65 void sendTokensToMainThread(); |
| 76 void updateDocument(const String& decodedData); | 66 void updateDocument(const String& decodedData); |
| 77 bool updateTokenizerState(const CompactHTMLToken& token); | 67 bool updateTokenizerState(const CompactHTMLToken& token); |
| 78 | 68 |
| 79 SegmentedString m_input; | 69 SegmentedString m_input; |
| 80 OwnPtr<HTMLToken> m_token; | 70 OwnPtr<HTMLToken> m_token; |
| 81 OwnPtr<HTMLTokenizer> m_tokenizer; | 71 OwnPtr<HTMLTokenizer> m_tokenizer; |
| 82 HTMLParserOptions m_options; | |
| 83 WeakPtr<HTMLDocumentParser> m_parser; | 72 WeakPtr<HTMLDocumentParser> m_parser; |
| 84 | 73 |
| 85 OwnPtr<CompactHTMLTokenStream> m_pendingTokens; | 74 OwnPtr<CompactHTMLTokenStream> m_pendingTokens; |
| 86 OwnPtr<TextResourceDecoder> m_decoder; | 75 OwnPtr<TextResourceDecoder> m_decoder; |
| 87 | 76 |
| 88 base::WeakPtrFactory<BackgroundHTMLParser> m_weakFactory; | 77 base::WeakPtrFactory<BackgroundHTMLParser> m_weakFactory; |
| 89 }; | 78 }; |
| 90 | 79 |
| 91 } | 80 } |
| 92 | 81 |
| 93 #endif | 82 #endif |
| OLD | NEW |