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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2411863002: [NoStatePrefetch] Kill renderer after preload scanning (Closed)
Patch Set: PrefetchNonexisting: FINAL_STATUS_UNSUPPORTED_SCHEME Created 4 years, 1 month 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 #include "platform/scroll/ScrollbarTheme.h" 234 #include "platform/scroll/ScrollbarTheme.h"
235 #include "platform/text/PlatformLocale.h" 235 #include "platform/text/PlatformLocale.h"
236 #include "platform/text/SegmentedString.h" 236 #include "platform/text/SegmentedString.h"
237 #include "platform/tracing/TraceEvent.h" 237 #include "platform/tracing/TraceEvent.h"
238 #include "platform/weborigin/OriginAccessEntry.h" 238 #include "platform/weborigin/OriginAccessEntry.h"
239 #include "platform/weborigin/SchemeRegistry.h" 239 #include "platform/weborigin/SchemeRegistry.h"
240 #include "platform/weborigin/SecurityOrigin.h" 240 #include "platform/weborigin/SecurityOrigin.h"
241 #include "public/platform/Platform.h" 241 #include "public/platform/Platform.h"
242 #include "public/platform/WebAddressSpace.h" 242 #include "public/platform/WebAddressSpace.h"
243 #include "public/platform/WebFrameScheduler.h" 243 #include "public/platform/WebFrameScheduler.h"
244 #include "public/platform/WebPrerenderingSupport.h"
244 #include "public/platform/WebScheduler.h" 245 #include "public/platform/WebScheduler.h"
245 #include "wtf/AutoReset.h" 246 #include "wtf/AutoReset.h"
246 #include "wtf/CurrentTime.h" 247 #include "wtf/CurrentTime.h"
247 #include "wtf/DateMath.h" 248 #include "wtf/DateMath.h"
248 #include "wtf/Functional.h" 249 #include "wtf/Functional.h"
249 #include "wtf/HashFunctions.h" 250 #include "wtf/HashFunctions.h"
250 #include "wtf/PtrUtil.h" 251 #include "wtf/PtrUtil.h"
251 #include "wtf/StdLibExtras.h" 252 #include "wtf/StdLibExtras.h"
252 #include "wtf/text/StringBuffer.h" 253 #include "wtf/text/StringBuffer.h"
253 #include "wtf/text/TextEncodingRegistry.h" 254 #include "wtf/text/TextEncodingRegistry.h"
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 1422
1422 bool Document::isPrefetchOnly() const { 1423 bool Document::isPrefetchOnly() const {
1423 if (!m_frame || !m_frame->page()) 1424 if (!m_frame || !m_frame->page())
1424 return false; 1425 return false;
1425 1426
1426 PrerendererClient* prerendererClient = 1427 PrerendererClient* prerendererClient =
1427 PrerendererClient::from(m_frame->page()); 1428 PrerendererClient::from(m_frame->page());
1428 return prerendererClient && prerendererClient->isPrefetchOnly(); 1429 return prerendererClient && prerendererClient->isPrefetchOnly();
1429 } 1430 }
1430 1431
1432 void Document::onPrefetchFinished() const {
1433 WebPrerenderingSupport::current()->prefetchFinished();
1434 }
1435
1431 String Document::visibilityState() const { 1436 String Document::visibilityState() const {
1432 return pageVisibilityStateString(pageVisibilityState()); 1437 return pageVisibilityStateString(pageVisibilityState());
1433 } 1438 }
1434 1439
1435 bool Document::hidden() const { 1440 bool Document::hidden() const {
1436 return pageVisibilityState() != PageVisibilityStateVisible; 1441 return pageVisibilityState() != PageVisibilityStateVisible;
1437 } 1442 }
1438 1443
1439 void Document::didChangeVisibilityState() { 1444 void Document::didChangeVisibilityState() {
1440 dispatchEvent(Event::createBubble(EventTypeNames::visibilitychange)); 1445 dispatchEvent(Event::createBubble(EventTypeNames::visibilitychange));
(...skipping 3695 matching lines...) Expand 10 before | Expand all | Expand 10 after
5136 // Schedule dropping of the ElementDataCache. We keep it alive for a while 5141 // Schedule dropping of the ElementDataCache. We keep it alive for a while
5137 // after parsing finishes so that dynamically inserted content can also 5142 // after parsing finishes so that dynamically inserted content can also
5138 // benefit from sharing optimizations. Note that we don't refresh the timer 5143 // benefit from sharing optimizations. Note that we don't refresh the timer
5139 // on cache access since that could lead to huge caches being kept alive 5144 // on cache access since that could lead to huge caches being kept alive
5140 // indefinitely by something innocuous like JS setting .innerHTML repeatedly 5145 // indefinitely by something innocuous like JS setting .innerHTML repeatedly
5141 // on a timer. 5146 // on a timer.
5142 m_elementDataCacheClearTimer.startOneShot(10, BLINK_FROM_HERE); 5147 m_elementDataCacheClearTimer.startOneShot(10, BLINK_FROM_HERE);
5143 5148
5144 // Parser should have picked up all preloads by now 5149 // Parser should have picked up all preloads by now
5145 m_fetcher->clearPreloads(ResourceFetcher::ClearSpeculativeMarkupPreloads); 5150 m_fetcher->clearPreloads(ResourceFetcher::ClearSpeculativeMarkupPreloads);
5151
5152 if (isPrefetchOnly())
5153 onPrefetchFinished();
5146 } 5154 }
5147 5155
5148 void Document::elementDataCacheClearTimerFired(TimerBase*) { 5156 void Document::elementDataCacheClearTimerFired(TimerBase*) {
5149 m_elementDataCache.clear(); 5157 m_elementDataCache.clear();
5150 } 5158 }
5151 5159
5152 void Document::beginLifecycleUpdatesIfRenderingReady() { 5160 void Document::beginLifecycleUpdatesIfRenderingReady() {
5153 if (!isActive()) 5161 if (!isActive())
5154 return; 5162 return;
5155 if (!isRenderingReady()) 5163 if (!isRenderingReady())
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
6409 } 6417 }
6410 6418
6411 void showLiveDocumentInstances() { 6419 void showLiveDocumentInstances() {
6412 WeakDocumentSet& set = liveDocumentSet(); 6420 WeakDocumentSet& set = liveDocumentSet();
6413 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6421 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6414 for (Document* document : set) 6422 for (Document* document : set)
6415 fprintf(stderr, "- Document %p URL: %s\n", document, 6423 fprintf(stderr, "- Document %p URL: %s\n", document,
6416 document->url().getString().utf8().data()); 6424 document->url().getString().utf8().data());
6417 } 6425 }
6418 #endif 6426 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698