OLD | NEW |
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 virtual blink::WebThread* backgroundThread() OVERRIDE FINAL | 93 virtual blink::WebThread* backgroundThread() OVERRIDE FINAL |
94 { | 94 { |
95 return &HTMLParserThread::shared()->platformThread(); | 95 return &HTMLParserThread::shared()->platformThread(); |
96 } | 96 } |
97 | 97 |
98 private: | 98 private: |
99 WeakPtr<BackgroundHTMLParser> m_backgroundParser; | 99 WeakPtr<BackgroundHTMLParser> m_backgroundParser; |
100 }; | 100 }; |
101 | 101 |
102 // FIXME: HTMLDocument should be a reference. | 102 HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, bool reportErrors
) |
103 HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors
) | 103 : ScriptableDocumentParser(document) |
104 : ScriptableDocumentParser(*document) | 104 , m_options(&document) |
105 , m_options(document) | |
106 , m_token(m_options.useThreading ? nullptr : adoptPtr(new HTMLToken)) | 105 , m_token(m_options.useThreading ? nullptr : adoptPtr(new HTMLToken)) |
107 , m_tokenizer(m_options.useThreading ? nullptr : HTMLTokenizer::create(m_opt
ions)) | 106 , m_tokenizer(m_options.useThreading ? nullptr : HTMLTokenizer::create(m_opt
ions)) |
108 , m_scriptRunner(HTMLScriptRunner::create(document, this)) | 107 , m_scriptRunner(HTMLScriptRunner::create(&document, this)) |
109 , m_treeBuilder(HTMLTreeBuilder::create(this, document, parserContentPolicy(
), reportErrors, m_options)) | 108 , m_treeBuilder(HTMLTreeBuilder::create(this, &document, parserContentPolicy
(), reportErrors, m_options)) |
110 , m_parserScheduler(HTMLParserScheduler::create(this)) | 109 , m_parserScheduler(HTMLParserScheduler::create(this)) |
111 , m_xssAuditorDelegate(document) | 110 , m_xssAuditorDelegate(&document) |
112 , m_weakFactory(this) | 111 , m_weakFactory(this) |
113 , m_preloader(adoptPtr(new HTMLResourcePreloader(document))) | 112 , m_preloader(adoptPtr(new HTMLResourcePreloader(&document))) |
114 , m_isPinnedToMainThread(false) | 113 , m_isPinnedToMainThread(false) |
115 , m_endWasDelayed(false) | 114 , m_endWasDelayed(false) |
116 , m_haveBackgroundParser(false) | 115 , m_haveBackgroundParser(false) |
117 , m_pumpSessionNestingLevel(0) | 116 , m_pumpSessionNestingLevel(0) |
118 { | 117 { |
119 ASSERT(shouldUseThreading() || (m_token && m_tokenizer)); | 118 ASSERT(shouldUseThreading() || (m_token && m_tokenizer)); |
120 } | 119 } |
121 | 120 |
122 // FIXME: Member variables should be grouped into self-initializing structs to | 121 // FIXME: Member variables should be grouped into self-initializing structs to |
123 // minimize code duplication between these constructors. | 122 // minimize code duplication between these constructors. |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1047 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
1049 { | 1048 { |
1050 ASSERT(decoder); | 1049 ASSERT(decoder); |
1051 DecodedDataDocumentParser::setDecoder(decoder); | 1050 DecodedDataDocumentParser::setDecoder(decoder); |
1052 | 1051 |
1053 if (m_haveBackgroundParser) | 1052 if (m_haveBackgroundParser) |
1054 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); | 1053 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); |
1055 } | 1054 } |
1056 | 1055 |
1057 } | 1056 } |
OLD | NEW |