| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 class ParserDataReceiver : public blink::WebThreadedDataReceiver { | 78 class ParserDataReceiver : public blink::WebThreadedDataReceiver { |
| 79 public: | 79 public: |
| 80 explicit ParserDataReceiver(WeakPtr<BackgroundHTMLParser> backgroundParser) | 80 explicit ParserDataReceiver(WeakPtr<BackgroundHTMLParser> backgroundParser) |
| 81 : m_backgroundParser(backgroundParser) | 81 : m_backgroundParser(backgroundParser) |
| 82 { | 82 { |
| 83 } | 83 } |
| 84 | 84 |
| 85 // WebThreadedDataReceiver | 85 // WebThreadedDataReceiver |
| 86 virtual void acceptData(const char* data, int dataLength) OVERRIDE FINAL | 86 virtual void acceptData(const char* data, int dataLength) OVERRIDE FINAL |
| 87 { | 87 { |
| 88 ASSERT(backgroundThread()->isCurrentThread()); | 88 ASSERT(backgroundThread() && backgroundThread()->isCurrentThread()); |
| 89 if (m_backgroundParser.get()) | 89 if (m_backgroundParser.get()) |
| 90 m_backgroundParser.get()->appendRawBytesFromParserThread(data, dataL
ength); | 90 m_backgroundParser.get()->appendRawBytesFromParserThread(data, dataL
ength); |
| 91 } | 91 } |
| 92 | 92 |
| 93 virtual blink::WebThread* backgroundThread() OVERRIDE FINAL | 93 virtual blink::WebThread* backgroundThread() OVERRIDE FINAL |
| 94 { | 94 { |
| 95 return &HTMLParserThread::shared()->platformThread(); | 95 if (HTMLParserThread::shared()) |
| 96 return &HTMLParserThread::shared()->platformThread(); |
| 97 |
| 98 return 0; |
| 96 } | 99 } |
| 97 | 100 |
| 98 private: | 101 private: |
| 99 WeakPtr<BackgroundHTMLParser> m_backgroundParser; | 102 WeakPtr<BackgroundHTMLParser> m_backgroundParser; |
| 100 }; | 103 }; |
| 101 | 104 |
| 102 HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, bool reportErrors
) | 105 HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, bool reportErrors
) |
| 103 : ScriptableDocumentParser(document) | 106 : ScriptableDocumentParser(document) |
| 104 , m_options(&document) | 107 , m_options(&document) |
| 105 , m_token(m_options.useThreading ? nullptr : adoptPtr(new HTMLToken)) | 108 , m_token(m_options.useThreading ? nullptr : adoptPtr(new HTMLToken)) |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1059 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
| 1057 { | 1060 { |
| 1058 ASSERT(decoder); | 1061 ASSERT(decoder); |
| 1059 DecodedDataDocumentParser::setDecoder(decoder); | 1062 DecodedDataDocumentParser::setDecoder(decoder); |
| 1060 | 1063 |
| 1061 if (m_haveBackgroundParser) | 1064 if (m_haveBackgroundParser) |
| 1062 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); | 1065 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); |
| 1063 } | 1066 } |
| 1064 | 1067 |
| 1065 } | 1068 } |
| OLD | NEW |