Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h

Issue 1641853003: Create MediaValuesCached and TokenPreloadScanner on the parser thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@TRV_MediaValuesCached
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698