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

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

Issue 2174263002: Defer loads in new pages/frames if ScopedPageLoadDeferral is active (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hammer Created 4 years, 5 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) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 void FrameLoader::init() 198 void FrameLoader::init()
199 { 199 {
200 ResourceRequest initialRequest(KURL(ParsedURLString, emptyString())); 200 ResourceRequest initialRequest(KURL(ParsedURLString, emptyString()));
201 initialRequest.setRequestContext(WebURLRequest::RequestContextInternal); 201 initialRequest.setRequestContext(WebURLRequest::RequestContextInternal);
202 initialRequest.setFrameType(m_frame->isMainFrame() ? WebURLRequest::FrameTyp eTopLevel : WebURLRequest::FrameTypeNested); 202 initialRequest.setFrameType(m_frame->isMainFrame() ? WebURLRequest::FrameTyp eTopLevel : WebURLRequest::FrameTypeNested);
203 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, initia lRequest, SubstituteData()); 203 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, initia lRequest, SubstituteData());
204 m_provisionalDocumentLoader->startLoadingMainResource(); 204 m_provisionalDocumentLoader->startLoadingMainResource();
205 m_frame->document()->cancelParsing(); 205 m_frame->document()->cancelParsing();
206 m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocu ment); 206 m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocu ment);
207 // Self-suspend if created in an already deferred Page. Note that
208 // cancelParsing() may have already detached the frame, since it fires a JS
209 // event.
210 if (m_frame->page() && m_frame->page()->defersLoading())
211 setDefersLoading(true);
dcheng 2016/07/25 06:48:18 This makes me pretty sad. When we initially create
207 takeObjectSnapshot(); 212 takeObjectSnapshot();
208 } 213 }
209 214
210 FrameLoaderClient* FrameLoader::client() const 215 FrameLoaderClient* FrameLoader::client() const
211 { 216 {
212 return static_cast<FrameLoaderClient*>(m_frame->client()); 217 return static_cast<FrameLoaderClient*>(m_frame->client());
213 } 218 }
214 219
215 void FrameLoader::setDefersLoading(bool defers) 220 void FrameLoader::setDefersLoading(bool defers)
216 { 221 {
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String()); 1615 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String());
1611 return tracedValue; 1616 return tracedValue;
1612 } 1617 }
1613 1618
1614 inline void FrameLoader::takeObjectSnapshot() const 1619 inline void FrameLoader::takeObjectSnapshot() const
1615 { 1620 {
1616 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value()); 1621 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value());
1617 } 1622 }
1618 1623
1619 } // namespace blink 1624 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698