| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 , m_shouldUseThreading(syncPolicy == AllowAsynchronousParsing) | 122 , m_shouldUseThreading(syncPolicy == AllowAsynchronousParsing) |
| 123 , m_endWasDelayed(false) | 123 , m_endWasDelayed(false) |
| 124 , m_haveBackgroundParser(false) | 124 , m_haveBackgroundParser(false) |
| 125 , m_tasksWereSuspended(false) | 125 , m_tasksWereSuspended(false) |
| 126 , m_pumpSessionNestingLevel(0) | 126 , m_pumpSessionNestingLevel(0) |
| 127 , m_pumpSpeculationsSessionNestingLevel(0) | 127 , m_pumpSpeculationsSessionNestingLevel(0) |
| 128 , m_isParsingAtLineNumber(false) | 128 , m_isParsingAtLineNumber(false) |
| 129 , m_triedLoadingLinkHeaders(false) | 129 , m_triedLoadingLinkHeaders(false) |
| 130 { | 130 { |
| 131 ASSERT(shouldUseThreading() || (m_token && m_tokenizer)); | 131 ASSERT(shouldUseThreading() || (m_token && m_tokenizer)); |
| 132 ThreadState::current()->registerPreFinalizer(this); |
| 132 } | 133 } |
| 133 | 134 |
| 134 HTMLDocumentParser::~HTMLDocumentParser() | 135 HTMLDocumentParser::~HTMLDocumentParser() |
| 135 { | 136 { |
| 137 } |
| 138 |
| 139 void HTMLDocumentParser::dispose() |
| 140 { |
| 136 // In Oilpan, HTMLDocumentParser can die together with Document, and | 141 // In Oilpan, HTMLDocumentParser can die together with Document, and |
| 137 // detach() is not called in this case. | 142 // detach() is not called in this case. |
| 138 if (m_haveBackgroundParser) | 143 if (m_haveBackgroundParser) |
| 139 stopBackgroundParser(); | 144 stopBackgroundParser(); |
| 140 } | 145 } |
| 141 | 146 |
| 142 DEFINE_TRACE(HTMLDocumentParser) | 147 DEFINE_TRACE(HTMLDocumentParser) |
| 143 { | 148 { |
| 144 visitor->trace(m_treeBuilder); | 149 visitor->trace(m_treeBuilder); |
| 145 visitor->trace(m_parserScheduler); | 150 visitor->trace(m_parserScheduler); |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 } | 719 } |
| 715 | 720 |
| 716 void HTMLDocumentParser::startBackgroundParser() | 721 void HTMLDocumentParser::startBackgroundParser() |
| 717 { | 722 { |
| 718 ASSERT(!isStopped()); | 723 ASSERT(!isStopped()); |
| 719 ASSERT(shouldUseThreading()); | 724 ASSERT(shouldUseThreading()); |
| 720 ASSERT(!m_haveBackgroundParser); | 725 ASSERT(!m_haveBackgroundParser); |
| 721 ASSERT(document()); | 726 ASSERT(document()); |
| 722 m_haveBackgroundParser = true; | 727 m_haveBackgroundParser = true; |
| 723 | 728 |
| 729 // TODO(alexclarke): Remove WebFrameScheduler::setDocumentParsingInBackgroun
d when background parser goes away. |
| 724 if (document()->frame() && document()->frame()->frameScheduler()) | 730 if (document()->frame() && document()->frame()->frameScheduler()) |
| 725 document()->frame()->frameScheduler()->setDocumentParsingInBackground(tr
ue); | 731 document()->frame()->frameScheduler()->setDocumentParsingInBackground(tr
ue); |
| 726 | 732 |
| 727 // Make sure that a resolver is set up, so that the correct viewport dimensi
ons will be fed to the background parser and preload scanner. | 733 // Make sure that a resolver is set up, so that the correct viewport dimensi
ons will be fed to the background parser and preload scanner. |
| 728 if (document()->loader()) | 734 if (document()->loader()) |
| 729 document()->ensureStyleResolver(); | 735 document()->ensureStyleResolver(); |
| 730 | 736 |
| 731 RefPtr<WeakReference<BackgroundHTMLParser>> reference = WeakReference<Backgr
oundHTMLParser>::createUnbound(); | 737 RefPtr<WeakReference<BackgroundHTMLParser>> reference = WeakReference<Backgr
oundHTMLParser>::createUnbound(); |
| 732 m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference); | 738 m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference); |
| 733 | 739 |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 (*WTF::bind(function, std::forward<Ps>(parameters)...))(); | 1169 (*WTF::bind(function, std::forward<Ps>(parameters)...))(); |
| 1164 return; | 1170 return; |
| 1165 case Asynchronous: | 1171 case Asynchronous: |
| 1166 m_loadingTaskRunner->postTask(BLINK_FROM_HERE, WTF::bind(function, std::
forward<Ps>(parameters)...)); | 1172 m_loadingTaskRunner->postTask(BLINK_FROM_HERE, WTF::bind(function, std::
forward<Ps>(parameters)...)); |
| 1167 return; | 1173 return; |
| 1168 } | 1174 } |
| 1169 NOTREACHED(); | 1175 NOTREACHED(); |
| 1170 } | 1176 } |
| 1171 | 1177 |
| 1172 } // namespace blink | 1178 } // namespace blink |
| OLD | NEW |