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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2172613002: Renderer-side changes for NoState Prefetch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix style Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/DocumentParser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index f8d81f74113d91ab2d04a58971a36c4c6f6bf22a..4f4d89c6d8ec706d4dd89bd94994ec059c8de610 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -195,6 +195,7 @@
#include "core/loader/FrameLoaderClient.h"
#include "core/loader/ImageLoader.h"
#include "core/loader/NavigationScheduler.h"
+#include "core/loader/PrerendererClient.h"
#include "core/loader/appcache/ApplicationCacheHost.h"
#include "core/observer/ResizeObserverController.h"
#include "core/page/ChromeClient.h"
@@ -1327,6 +1328,15 @@ PageVisibilityState Document::pageVisibilityState() const
return m_frame->page()->visibilityState();
}
+bool Document::isPrefetchOnly() const
+{
+ if (!m_frame || !m_frame->page())
+ return false;
+
+ PrerendererClient* prerendererClient = PrerendererClient::from(m_frame->page());
+ return prerendererClient && prerendererClient->isPrefetchOnly();
+}
+
String Document::visibilityState() const
{
return pageVisibilityStateString(pageVisibilityState());
@@ -2437,8 +2447,12 @@ DocumentParser* Document::implicitOpen(ParserSynchronizationPolicy parserSyncPol
setCompatibilityMode(NoQuirksMode);
- if (!threadedParsingEnabledForTesting())
+ if (!threadedParsingEnabledForTesting()) {
parserSyncPolicy = ForceSynchronousParsing;
+ } else if (parserSyncPolicy == AllowAsynchronousParsing && isPrefetchOnly()) {
+ // Prefetch must be synchronous.
+ parserSyncPolicy = ForceSynchronousParsing;
+ }
m_parserSyncPolicy = parserSyncPolicy;
m_parser = createParser();
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/DocumentParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698