| 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 // Threading is not allowed in prefetch mode. |
| 133 DCHECK(!document.isPrefetchOnly() || !shouldUseThreading()); |
| 134 |
| 132 ThreadState::current()->registerPreFinalizer(this); | 135 ThreadState::current()->registerPreFinalizer(this); |
| 133 } | 136 } |
| 134 | 137 |
| 135 HTMLDocumentParser::~HTMLDocumentParser() | 138 HTMLDocumentParser::~HTMLDocumentParser() |
| 136 { | 139 { |
| 137 } | 140 } |
| 138 | 141 |
| 139 void HTMLDocumentParser::dispose() | 142 void HTMLDocumentParser::dispose() |
| 140 { | 143 { |
| 141 // In Oilpan, HTMLDocumentParser can die together with Document, and | 144 // In Oilpan, HTMLDocumentParser can die together with Document, and |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 if (isStopped()) | 790 if (isStopped()) |
| 788 return; | 791 return; |
| 789 | 792 |
| 790 // We should never reach this point if we're using a parser thread, | 793 // We should never reach this point if we're using a parser thread, |
| 791 // as appendBytes() will directly ship the data to the thread. | 794 // as appendBytes() will directly ship the data to the thread. |
| 792 ASSERT(!shouldUseThreading()); | 795 ASSERT(!shouldUseThreading()); |
| 793 | 796 |
| 794 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "HTMLDocumentParser::
append", "size", inputSource.length()); | 797 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "HTMLDocumentParser::
append", "size", inputSource.length()); |
| 795 const SegmentedString source(inputSource); | 798 const SegmentedString source(inputSource); |
| 796 | 799 |
| 800 if (document()->isPrefetchOnly()) { |
| 801 if (!m_preloadScanner) |
| 802 m_preloadScanner = createPreloadScanner(); |
| 803 |
| 804 m_preloadScanner->appendToEnd(source); |
| 805 // TODO(droger): Set the LOAD_PREFETCH flags on the requests. |
| 806 m_preloadScanner->scanAndPreload(m_preloader.get(), document()->validBas
eElementURL(), nullptr); |
| 807 |
| 808 // Return after the preload scanner, do not actually parse the document. |
| 809 return; |
| 810 } |
| 811 |
| 797 if (m_preloadScanner) { | 812 if (m_preloadScanner) { |
| 798 if (m_input.current().isEmpty() && !isWaitingForScripts()) { | 813 if (m_input.current().isEmpty() && !isWaitingForScripts()) { |
| 799 // We have parsed until the end of the current input and so are now
moving ahead of the preload scanner. | 814 // We have parsed until the end of the current input and so are now
moving ahead of the preload scanner. |
| 800 // Clear the scanner so we know to scan starting from the current in
put point if we block again. | 815 // Clear the scanner so we know to scan starting from the current in
put point if we block again. |
| 801 m_preloadScanner.reset(); | 816 m_preloadScanner.reset(); |
| 802 } else { | 817 } else { |
| 803 m_preloadScanner->appendToEnd(source); | 818 m_preloadScanner->appendToEnd(source); |
| 804 if (isWaitingForScripts()) | 819 if (isWaitingForScripts()) |
| 805 m_preloadScanner->scanAndPreload(m_preloader.get(), document()->
validBaseElementURL(), nullptr); | 820 m_preloadScanner->scanAndPreload(m_preloader.get(), document()->
validBaseElementURL(), nullptr); |
| 806 } | 821 } |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 (*WTF::bind(function, std::forward<Ps>(parameters)...))(); | 1184 (*WTF::bind(function, std::forward<Ps>(parameters)...))(); |
| 1170 return; | 1185 return; |
| 1171 case Asynchronous: | 1186 case Asynchronous: |
| 1172 m_loadingTaskRunner->postTask(BLINK_FROM_HERE, WTF::bind(function, std::
forward<Ps>(parameters)...)); | 1187 m_loadingTaskRunner->postTask(BLINK_FROM_HERE, WTF::bind(function, std::
forward<Ps>(parameters)...)); |
| 1173 return; | 1188 return; |
| 1174 } | 1189 } |
| 1175 NOTREACHED(); | 1190 NOTREACHED(); |
| 1176 } | 1191 } |
| 1177 | 1192 |
| 1178 } // namespace blink | 1193 } // namespace blink |
| OLD | NEW |