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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp

Issue 2411863002: [NoStatePrefetch] Kill renderer after preload scanning (Closed)
Patch Set: Created 4 years, 2 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 30 matching lines...) Expand all
41 #include "core/html/parser/HTMLParserScheduler.h" 41 #include "core/html/parser/HTMLParserScheduler.h"
42 #include "core/html/parser/HTMLParserThread.h" 42 #include "core/html/parser/HTMLParserThread.h"
43 #include "core/html/parser/HTMLResourcePreloader.h" 43 #include "core/html/parser/HTMLResourcePreloader.h"
44 #include "core/html/parser/HTMLScriptRunner.h" 44 #include "core/html/parser/HTMLScriptRunner.h"
45 #include "core/html/parser/HTMLTreeBuilder.h" 45 #include "core/html/parser/HTMLTreeBuilder.h"
46 #include "core/inspector/InspectorInstrumentation.h" 46 #include "core/inspector/InspectorInstrumentation.h"
47 #include "core/inspector/InspectorTraceEvents.h" 47 #include "core/inspector/InspectorTraceEvents.h"
48 #include "core/loader/DocumentLoader.h" 48 #include "core/loader/DocumentLoader.h"
49 #include "core/loader/LinkLoader.h" 49 #include "core/loader/LinkLoader.h"
50 #include "core/loader/NavigationScheduler.h" 50 #include "core/loader/NavigationScheduler.h"
51 #include "core/loader/PrerendererClient.h"
51 #include "platform/CrossThreadFunctional.h" 52 #include "platform/CrossThreadFunctional.h"
52 #include "platform/Histogram.h" 53 #include "platform/Histogram.h"
53 #include "platform/SharedBuffer.h" 54 #include "platform/SharedBuffer.h"
54 #include "platform/heap/Handle.h" 55 #include "platform/heap/Handle.h"
55 #include "platform/tracing/TraceEvent.h" 56 #include "platform/tracing/TraceEvent.h"
56 #include "public/platform/Platform.h" 57 #include "public/platform/Platform.h"
57 #include "public/platform/WebFrameScheduler.h" 58 #include "public/platform/WebFrameScheduler.h"
58 #include "public/platform/WebLoadingBehaviorFlag.h" 59 #include "public/platform/WebLoadingBehaviorFlag.h"
59 #include "public/platform/WebScheduler.h" 60 #include "public/platform/WebScheduler.h"
60 #include "public/platform/WebThread.h" 61 #include "public/platform/WebThread.h"
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 917
917 pumpTokenizerIfPossible(); 918 pumpTokenizerIfPossible();
918 919
919 endIfDelayed(); 920 endIfDelayed();
920 } 921 }
921 922
922 void HTMLDocumentParser::end() { 923 void HTMLDocumentParser::end() {
923 ASSERT(!isDetached()); 924 ASSERT(!isDetached());
924 ASSERT(!isScheduledForResume()); 925 ASSERT(!isScheduledForResume());
925 926
927 // Early determine if running a prefetch. At later stages the |document()| may
droger 2016/10/12 09:12:58 Nit: You're still calling document() at the end. M
pasko 2016/10/12 13:59:40 The comment is accurate, but confusing a lot, I ag
928 // be unavailable.
929 bool prefetchOnly = false;
930 if (document()->isPrefetchOnly())
931 prefetchOnly = true;
932
926 if (m_haveBackgroundParser) 933 if (m_haveBackgroundParser)
927 stopBackgroundParser(); 934 stopBackgroundParser();
928 935
929 // Informs the the rest of WebCore that parsing is really finished (and 936 // Informs the the rest of WebCore that parsing is really finished (and
930 // deletes this). 937 // deletes this).
931 m_treeBuilder->finished(); 938 m_treeBuilder->finished();
932 939
933 DocumentParser::stopParsing(); 940 DocumentParser::stopParsing();
941 if (prefetchOnly)
942 document()->onPrefetchFinished();
934 } 943 }
935 944
936 void HTMLDocumentParser::attemptToRunDeferredScriptsAndEnd() { 945 void HTMLDocumentParser::attemptToRunDeferredScriptsAndEnd() {
937 ASSERT(isStopping()); 946 ASSERT(isStopping());
938 // FIXME: It may not be correct to disable this for the background parser. 947 // FIXME: It may not be correct to disable this for the background parser.
939 // That means hasInsertionPoint() may not be correct in some cases. 948 // That means hasInsertionPoint() may not be correct in some cases.
940 ASSERT(!hasInsertionPoint() || m_haveBackgroundParser); 949 ASSERT(!hasInsertionPoint() || m_haveBackgroundParser);
941 if (m_scriptRunner && !m_scriptRunner->executeScriptsWaitingForParsing()) 950 if (m_scriptRunner && !m_scriptRunner->executeScriptsWaitingForParsing())
942 return; 951 return;
943 end(); 952 end();
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 case Asynchronous: 1304 case Asynchronous:
1296 m_loadingTaskRunner->postTask( 1305 m_loadingTaskRunner->postTask(
1297 BLINK_FROM_HERE, 1306 BLINK_FROM_HERE,
1298 WTF::bind(function, std::forward<Ps>(parameters)...)); 1307 WTF::bind(function, std::forward<Ps>(parameters)...));
1299 return; 1308 return;
1300 } 1309 }
1301 NOTREACHED(); 1310 NOTREACHED();
1302 } 1311 }
1303 1312
1304 } // namespace blink 1313 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698