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

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

Issue 100563004: Redirect HTML resource bytes directly to parser thread (Blink side CL) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@parserthread_decodermove
Patch Set: Cache parser thread pointer in HTMLDocumentParser Created 6 years, 11 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) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "core/html/parser/HTMLTreeBuilderSimulator.h" 42 #include "core/html/parser/HTMLTreeBuilderSimulator.h"
43 #include "core/html/parser/TextResourceDecoder.h" 43 #include "core/html/parser/TextResourceDecoder.h"
44 #include "core/html/parser/XSSAuditor.h" 44 #include "core/html/parser/XSSAuditor.h"
45 #include "core/html/parser/XSSAuditorDelegate.h" 45 #include "core/html/parser/XSSAuditorDelegate.h"
46 #include "platform/text/SegmentedString.h" 46 #include "platform/text/SegmentedString.h"
47 #include "wtf/Deque.h" 47 #include "wtf/Deque.h"
48 #include "wtf/OwnPtr.h" 48 #include "wtf/OwnPtr.h"
49 #include "wtf/WeakPtr.h" 49 #include "wtf/WeakPtr.h"
50 #include "wtf/text/TextPosition.h" 50 #include "wtf/text/TextPosition.h"
51 51
52 namespace blink {
53 class WebThreadedResourceProvider;
54 class WebThread;
55 }
56
52 namespace WebCore { 57 namespace WebCore {
53 58
54 class BackgroundHTMLParser; 59 class BackgroundHTMLParser;
55 class CompactHTMLToken; 60 class CompactHTMLToken;
56 class Document; 61 class Document;
57 class DocumentFragment; 62 class DocumentFragment;
58 class HTMLDocument; 63 class HTMLDocument;
59 class HTMLParserScheduler; 64 class HTMLParserScheduler;
60 class HTMLScriptRunner; 65 class HTMLScriptRunner;
61 class HTMLTreeBuilder; 66 class HTMLTreeBuilder;
(...skipping 29 matching lines...) Expand all
91 OwnPtr<CompactHTMLTokenStream> tokens; 96 OwnPtr<CompactHTMLTokenStream> tokens;
92 PreloadRequestStream preloads; 97 PreloadRequestStream preloads;
93 XSSInfoStream xssInfos; 98 XSSInfoStream xssInfos;
94 HTMLTokenizer::State tokenizerState; 99 HTMLTokenizer::State tokenizerState;
95 HTMLTreeBuilderSimulator::State treeBuilderState; 100 HTMLTreeBuilderSimulator::State treeBuilderState;
96 HTMLInputCheckpoint inputCheckpoint; 101 HTMLInputCheckpoint inputCheckpoint;
97 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; 102 TokenPreloadScannerCheckpoint preloadScannerCheckpoint;
98 }; 103 };
99 void didReceiveParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); 104 void didReceiveParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>);
100 void didReceiveEncodingDataFromBackgroundParser(const DocumentEncodingData&) ; 105 void didReceiveEncodingDataFromBackgroundParser(const DocumentEncodingData&) ;
106 static void destroyResourceProvider(PassOwnPtr<blink::WebThreadedResourcePro vider>);
101 107
102 virtual void appendBytes(const char* bytes, size_t length) OVERRIDE; 108 virtual void appendBytes(const char* bytes, size_t length) OVERRIDE;
103 virtual void flush() OVERRIDE FINAL; 109 virtual void flush() OVERRIDE FINAL;
104 virtual void setDecoder(PassOwnPtr<TextResourceDecoder>) OVERRIDE FINAL; 110 virtual void setDecoder(PassOwnPtr<TextResourceDecoder>) OVERRIDE FINAL;
105 111
112 void didSwitchedToBackgroundClient();
113
106 UseCounter* useCounter() { return UseCounter::getFrom(contextForParsingSessi on()); } 114 UseCounter* useCounter() { return UseCounter::getFrom(contextForParsingSessi on()); }
107 115
108 protected: 116 protected:
109 virtual void insert(const SegmentedString&) OVERRIDE FINAL; 117 virtual void insert(const SegmentedString&) OVERRIDE FINAL;
110 virtual void append(PassRefPtr<StringImpl>) OVERRIDE; 118 virtual void append(PassRefPtr<StringImpl>) OVERRIDE;
111 virtual void finish() OVERRIDE FINAL; 119 virtual void finish() OVERRIDE FINAL;
112 120
113 HTMLDocumentParser(HTMLDocument*, bool reportErrors); 121 HTMLDocumentParser(HTMLDocument*, bool reportErrors);
114 HTMLDocumentParser(DocumentFragment*, Element* contextElement, ParserContent Policy); 122 HTMLDocumentParser(DocumentFragment*, Element* contextElement, ParserContent Policy);
115 123
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // so they can be set and cleared together and passed between threads togeth er. 207 // so they can be set and cleared together and passed between threads togeth er.
200 OwnPtr<ParsedChunk> m_lastChunkBeforeScript; 208 OwnPtr<ParsedChunk> m_lastChunkBeforeScript;
201 Deque<OwnPtr<ParsedChunk> > m_speculations; 209 Deque<OwnPtr<ParsedChunk> > m_speculations;
202 WeakPtrFactory<HTMLDocumentParser> m_weakFactory; 210 WeakPtrFactory<HTMLDocumentParser> m_weakFactory;
203 WeakPtr<BackgroundHTMLParser> m_backgroundParser; 211 WeakPtr<BackgroundHTMLParser> m_backgroundParser;
204 OwnPtr<HTMLResourcePreloader> m_preloader; 212 OwnPtr<HTMLResourcePreloader> m_preloader;
205 213
206 bool m_isPinnedToMainThread; 214 bool m_isPinnedToMainThread;
207 bool m_endWasDelayed; 215 bool m_endWasDelayed;
208 bool m_haveBackgroundParser; 216 bool m_haveBackgroundParser;
217 static blink::WebThread* s_parserThread;
abarth-chromium 2014/02/03 21:17:36 Why did you move this static out of its dedicated
oystein (OOO til 10th of July) 2014/02/05 00:05:00 The parser thread itself now has to be managed by
209 unsigned m_pumpSessionNestingLevel; 218 unsigned m_pumpSessionNestingLevel;
219 bool m_parserThreadIsStandalone;
210 }; 220 };
211 221
212 } 222 }
213 223
214 #endif 224 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698