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

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

Issue 1087203002: Patch 2/3 to get WebScheduler via WebThread (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Style nits Created 5 years, 8 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
« no previous file with comments | « Source/core/dom/ScriptRunnerTest.cpp ('k') | Source/core/html/parser/BackgroundHTMLParser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 23 matching lines...) Expand all
34 #include "core/html/parser/HTMLSourceTracker.h" 34 #include "core/html/parser/HTMLSourceTracker.h"
35 #include "core/html/parser/HTMLTreeBuilderSimulator.h" 35 #include "core/html/parser/HTMLTreeBuilderSimulator.h"
36 #include "core/html/parser/TextResourceDecoder.h" 36 #include "core/html/parser/TextResourceDecoder.h"
37 #include "core/html/parser/XSSAuditorDelegate.h" 37 #include "core/html/parser/XSSAuditorDelegate.h"
38 #include "wtf/PassOwnPtr.h" 38 #include "wtf/PassOwnPtr.h"
39 #include "wtf/WeakPtr.h" 39 #include "wtf/WeakPtr.h"
40 40
41 namespace blink { 41 namespace blink {
42 42
43 class HTMLDocumentParser; 43 class HTMLDocumentParser;
44 class Scheduler;
45 class XSSAuditor; 44 class XSSAuditor;
45 class WebScheduler;
46 46
47 class BackgroundHTMLParser { 47 class BackgroundHTMLParser {
48 WTF_MAKE_FAST_ALLOCATED(BackgroundHTMLParser); 48 WTF_MAKE_FAST_ALLOCATED(BackgroundHTMLParser);
49 public: 49 public:
50 struct Configuration { 50 struct Configuration {
51 HTMLParserOptions options; 51 HTMLParserOptions options;
52 WeakPtr<HTMLDocumentParser> parser; 52 WeakPtr<HTMLDocumentParser> parser;
53 OwnPtr<XSSAuditor> xssAuditor; 53 OwnPtr<XSSAuditor> xssAuditor;
54 OwnPtr<TokenPreloadScanner> preloadScanner; 54 OwnPtr<TokenPreloadScanner> preloadScanner;
55 OwnPtr<TextResourceDecoder> decoder; 55 OwnPtr<TextResourceDecoder> decoder;
56 }; 56 };
57 57
58 static void start(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOwnPt r<Configuration>, Scheduler*); 58 static void start(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOwnPt r<Configuration>, WebScheduler*);
59 59
60 struct Checkpoint { 60 struct Checkpoint {
61 WeakPtr<HTMLDocumentParser> parser; 61 WeakPtr<HTMLDocumentParser> parser;
62 OwnPtr<HTMLToken> token; 62 OwnPtr<HTMLToken> token;
63 OwnPtr<HTMLTokenizer> tokenizer; 63 OwnPtr<HTMLTokenizer> tokenizer;
64 HTMLTreeBuilderSimulator::State treeBuilderState; 64 HTMLTreeBuilderSimulator::State treeBuilderState;
65 HTMLInputCheckpoint inputCheckpoint; 65 HTMLInputCheckpoint inputCheckpoint;
66 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; 66 TokenPreloadScannerCheckpoint preloadScannerCheckpoint;
67 String unparsedInput; 67 String unparsedInput;
68 }; 68 };
69 69
70 void appendRawBytesFromParserThread(const char* data, int dataLength); 70 void appendRawBytesFromParserThread(const char* data, int dataLength);
71 71
72 void appendRawBytesFromMainThread(PassOwnPtr<Vector<char>>); 72 void appendRawBytesFromMainThread(PassOwnPtr<Vector<char>>);
73 void setDecoder(PassOwnPtr<TextResourceDecoder>); 73 void setDecoder(PassOwnPtr<TextResourceDecoder>);
74 void flush(); 74 void flush();
75 void resumeFrom(PassOwnPtr<Checkpoint>); 75 void resumeFrom(PassOwnPtr<Checkpoint>);
76 void startedChunkWithCheckpoint(HTMLInputCheckpoint); 76 void startedChunkWithCheckpoint(HTMLInputCheckpoint);
77 void finish(); 77 void finish();
78 void stop(); 78 void stop();
79 79
80 void forcePlaintextForTextDocument(); 80 void forcePlaintextForTextDocument();
81 81
82 private: 82 private:
83 BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOw nPtr<Configuration>, Scheduler*); 83 BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOw nPtr<Configuration>, WebScheduler*);
84 ~BackgroundHTMLParser(); 84 ~BackgroundHTMLParser();
85 85
86 void appendDecodedBytes(const String&); 86 void appendDecodedBytes(const String&);
87 void markEndOfFile(); 87 void markEndOfFile();
88 void pumpTokenizer(); 88 void pumpTokenizer();
89 void sendTokensToMainThread(); 89 void sendTokensToMainThread();
90 void updateDocument(const String& decodedData); 90 void updateDocument(const String& decodedData);
91 91
92 WeakPtrFactory<BackgroundHTMLParser> m_weakFactory; 92 WeakPtrFactory<BackgroundHTMLParser> m_weakFactory;
93 BackgroundHTMLInputStream m_input; 93 BackgroundHTMLInputStream m_input;
94 HTMLSourceTracker m_sourceTracker; 94 HTMLSourceTracker m_sourceTracker;
95 OwnPtr<HTMLToken> m_token; 95 OwnPtr<HTMLToken> m_token;
96 OwnPtr<HTMLTokenizer> m_tokenizer; 96 OwnPtr<HTMLTokenizer> m_tokenizer;
97 HTMLTreeBuilderSimulator m_treeBuilderSimulator; 97 HTMLTreeBuilderSimulator m_treeBuilderSimulator;
98 HTMLParserOptions m_options; 98 HTMLParserOptions m_options;
99 WeakPtr<HTMLDocumentParser> m_parser; 99 WeakPtr<HTMLDocumentParser> m_parser;
100 100
101 OwnPtr<CompactHTMLTokenStream> m_pendingTokens; 101 OwnPtr<CompactHTMLTokenStream> m_pendingTokens;
102 PreloadRequestStream m_pendingPreloads; 102 PreloadRequestStream m_pendingPreloads;
103 XSSInfoStream m_pendingXSSInfos; 103 XSSInfoStream m_pendingXSSInfos;
104 104
105 OwnPtr<XSSAuditor> m_xssAuditor; 105 OwnPtr<XSSAuditor> m_xssAuditor;
106 OwnPtr<TokenPreloadScanner> m_preloadScanner; 106 OwnPtr<TokenPreloadScanner> m_preloadScanner;
107 OwnPtr<TextResourceDecoder> m_decoder; 107 OwnPtr<TextResourceDecoder> m_decoder;
108 DocumentEncodingData m_lastSeenEncodingData; 108 DocumentEncodingData m_lastSeenEncodingData;
109 Scheduler* m_scheduler; // NOT OWNED, scheduler will outlive BackgroundHTMLP arser 109 WebScheduler* m_scheduler; // NOT OWNED, scheduler will outlive BackgroundHT MLParser
110 110
111 bool m_startingScript; 111 bool m_startingScript;
112 }; 112 };
113 113
114 } 114 }
115 115
116 #endif 116 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/ScriptRunnerTest.cpp ('k') | Source/core/html/parser/BackgroundHTMLParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698