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

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2526163002: Rename blink::Page's load deferral to suspension (Closed)
Patch Set: Created 4 years 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) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
6 * (http://www.torchmobile.com/) 6 * (http://www.torchmobile.com/)
7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
10 * Copyright (C) 2011 Google Inc. All rights reserved. 10 * Copyright (C) 2011 Google Inc. All rights reserved.
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 initialRequest.setFrameType(m_frame->isMainFrame() 221 initialRequest.setFrameType(m_frame->isMainFrame()
222 ? WebURLRequest::FrameTypeTopLevel 222 ? WebURLRequest::FrameTypeTopLevel
223 : WebURLRequest::FrameTypeNested); 223 : WebURLRequest::FrameTypeNested);
224 m_provisionalDocumentLoader = 224 m_provisionalDocumentLoader =
225 client()->createDocumentLoader(m_frame, initialRequest, SubstituteData(), 225 client()->createDocumentLoader(m_frame, initialRequest, SubstituteData(),
226 ClientRedirectPolicy::NotClientRedirect); 226 ClientRedirectPolicy::NotClientRedirect);
227 m_provisionalDocumentLoader->startLoadingMainResource(); 227 m_provisionalDocumentLoader->startLoadingMainResource();
228 m_frame->document()->cancelParsing(); 228 m_frame->document()->cancelParsing();
229 m_stateMachine.advanceTo( 229 m_stateMachine.advanceTo(
230 FrameLoaderStateMachine::DisplayingInitialEmptyDocument); 230 FrameLoaderStateMachine::DisplayingInitialEmptyDocument);
231 // Self-suspend if created in an already deferred Page. Note that both 231 // Self-suspend if created in an already suspended Page. Note that both
232 // startLoadingMainResource() and cancelParsing() may have already detached 232 // startLoadingMainResource() and cancelParsing() may have already detached
233 // the frame, since they both fire JS events. 233 // the frame, since they both fire JS events.
234 if (m_frame->page() && m_frame->page()->defersLoading()) 234 if (m_frame->page() && m_frame->page()->suspended())
235 setDefersLoading(true); 235 setDefersLoading(true);
236 takeObjectSnapshot(); 236 takeObjectSnapshot();
237 } 237 }
238 238
239 FrameLoaderClient* FrameLoader::client() const { 239 FrameLoaderClient* FrameLoader::client() const {
240 return static_cast<FrameLoaderClient*>(m_frame->client()); 240 return static_cast<FrameLoaderClient*>(m_frame->client());
241 } 241 }
242 242
243 void FrameLoader::setDefersLoading(bool defers) { 243 void FrameLoader::setDefersLoading(bool defers) {
244 if (m_provisionalDocumentLoader) 244 if (m_provisionalDocumentLoader)
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 m_frame->localDOMWindow()->finishedLoading(); 748 m_frame->localDOMWindow()->finishedLoading();
749 } 749 }
750 750
751 Frame* parent = m_frame->tree().parent(); 751 Frame* parent = m_frame->tree().parent();
752 if (parent && parent->isLocalFrame()) 752 if (parent && parent->isLocalFrame())
753 toLocalFrame(parent)->loader().checkCompleted(); 753 toLocalFrame(parent)->loader().checkCompleted();
754 } 754 }
755 755
756 void FrameLoader::checkTimerFired(TimerBase*) { 756 void FrameLoader::checkTimerFired(TimerBase*) {
757 if (Page* page = m_frame->page()) { 757 if (Page* page = m_frame->page()) {
758 if (page->defersLoading()) 758 if (page->suspended())
759 return; 759 return;
760 } 760 }
761 checkCompleted(); 761 checkCompleted();
762 } 762 }
763 763
764 void FrameLoader::scheduleCheckCompleted() { 764 void FrameLoader::scheduleCheckCompleted() {
765 if (!m_checkTimer.isActive()) 765 if (!m_checkTimer.isActive())
766 m_checkTimer.startOneShot(0, BLINK_FROM_HERE); 766 m_checkTimer.startOneShot(0, BLINK_FROM_HERE);
767 } 767 }
768 768
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 HistoryItem* historyItem, 1092 HistoryItem* historyItem,
1093 HistoryLoadType historyLoadType) { 1093 HistoryLoadType historyLoadType) {
1094 DCHECK(m_frame->document()); 1094 DCHECK(m_frame->document());
1095 1095
1096 if (!m_frame->isNavigationAllowed()) 1096 if (!m_frame->isNavigationAllowed())
1097 return; 1097 return;
1098 1098
1099 if (m_inStopAllLoaders) 1099 if (m_inStopAllLoaders)
1100 return; 1100 return;
1101 1101
1102 if (m_frame->page()->defersLoading() && 1102 if (m_frame->page()->suspended() && isBackForwardLoadType(frameLoadType)) {
1103 isBackForwardLoadType(frameLoadType)) {
1104 m_deferredHistoryLoad = DeferredHistoryLoad::create( 1103 m_deferredHistoryLoad = DeferredHistoryLoad::create(
1105 passedRequest.resourceRequest(), historyItem, frameLoadType, 1104 passedRequest.resourceRequest(), historyItem, frameLoadType,
1106 historyLoadType); 1105 historyLoadType);
1107 return; 1106 return;
1108 } 1107 }
1109 1108
1110 FrameLoadRequest request(passedRequest); 1109 FrameLoadRequest request(passedRequest);
1111 request.resourceRequest().setHasUserGesture( 1110 request.resourceRequest().setHasUserGesture(
1112 UserGestureIndicator::processingUserGesture()); 1111 UserGestureIndicator::processingUserGesture());
1113 1112
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
1958 m_documentLoader ? m_documentLoader->url() : String()); 1957 m_documentLoader ? m_documentLoader->url() : String());
1959 return tracedValue; 1958 return tracedValue;
1960 } 1959 }
1961 1960
1962 inline void FrameLoader::takeObjectSnapshot() const { 1961 inline void FrameLoader::takeObjectSnapshot() const {
1963 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, 1962 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
1964 toTracedValue()); 1963 toTracedValue());
1965 } 1964 }
1966 1965
1967 } // namespace blink 1966 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698