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

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

Issue 2524273002: Move ExecutionContext's task suspension from FrameLoader to Page
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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 suspended 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()->suspended()) 234 if (m_frame->page() && m_frame->page()->suspended()) {
235 m_provisionalDocumentLoader->fetcher()->setDefersLoading(true);
236 m_frame->document()->suspendScheduledTasks();
235 setDefersLoading(true); 237 setDefersLoading(true);
238 }
236 takeObjectSnapshot(); 239 takeObjectSnapshot();
237 } 240 }
238 241
239 FrameLoaderClient* FrameLoader::client() const { 242 FrameLoaderClient* FrameLoader::client() const {
240 return static_cast<FrameLoaderClient*>(m_frame->client()); 243 return static_cast<FrameLoaderClient*>(m_frame->client());
241 } 244 }
242 245
243 void FrameLoader::setDefersLoading(bool defers) { 246 void FrameLoader::setDefersLoading(bool defers) {
244 if (m_provisionalDocumentLoader) 247 if (m_provisionalDocumentLoader)
245 m_provisionalDocumentLoader->fetcher()->setDefersLoading(defers); 248 m_provisionalDocumentLoader->fetcher()->setDefersLoading(defers);
246 249
247 if (Document* document = m_frame->document()) {
248 document->fetcher()->setDefersLoading(defers);
249 if (defers)
250 document->suspendScheduledTasks();
251 else
252 document->resumeScheduledTasks();
253 }
254
255 if (!defers) { 250 if (!defers) {
256 if (m_deferredHistoryLoad) { 251 if (m_deferredHistoryLoad) {
257 load(FrameLoadRequest(nullptr, m_deferredHistoryLoad->m_request), 252 load(FrameLoadRequest(nullptr, m_deferredHistoryLoad->m_request),
258 m_deferredHistoryLoad->m_loadType, 253 m_deferredHistoryLoad->m_loadType,
259 m_deferredHistoryLoad->m_item.get(), 254 m_deferredHistoryLoad->m_item.get(),
260 m_deferredHistoryLoad->m_historyLoadType); 255 m_deferredHistoryLoad->m_historyLoadType);
261 m_deferredHistoryLoad.clear(); 256 m_deferredHistoryLoad.clear();
262 } 257 }
263 m_frame->navigationScheduler().startTimer(); 258 m_frame->navigationScheduler().startTimer();
264 scheduleCheckCompleted(); 259 scheduleCheckCompleted();
(...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 m_documentLoader ? m_documentLoader->url() : String()); 1952 m_documentLoader ? m_documentLoader->url() : String());
1958 return tracedValue; 1953 return tracedValue;
1959 } 1954 }
1960 1955
1961 inline void FrameLoader::takeObjectSnapshot() const { 1956 inline void FrameLoader::takeObjectSnapshot() const {
1962 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, 1957 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
1963 toTracedValue()); 1958 toTracedValue());
1964 } 1959 }
1965 1960
1966 } // namespace blink 1961 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/page/Page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698