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

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

Issue 2171063002: Notify the Blink client synchronously if the initial doc is accessed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments. 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 return request; 163 return request;
164 } 164 }
165 165
166 FrameLoader::FrameLoader(LocalFrame* frame) 166 FrameLoader::FrameLoader(LocalFrame* frame)
167 : m_frame(frame) 167 : m_frame(frame)
168 , m_progressTracker(ProgressTracker::create(frame)) 168 , m_progressTracker(ProgressTracker::create(frame))
169 , m_loadType(FrameLoadTypeStandard) 169 , m_loadType(FrameLoadTypeStandard)
170 , m_inStopAllLoaders(false) 170 , m_inStopAllLoaders(false)
171 , m_checkTimer(this, &FrameLoader::checkTimerFired) 171 , m_checkTimer(this, &FrameLoader::checkTimerFired)
172 , m_didAccessInitialDocument(false) 172 , m_didAccessInitialDocument(false)
173 , m_didAccessInitialDocumentTimer(this, &FrameLoader::didAccessInitialDocume ntTimerFired)
174 , m_forcedSandboxFlags(SandboxNone) 173 , m_forcedSandboxFlags(SandboxNone)
175 , m_dispatchingDidClearWindowObjectInMainWorld(false) 174 , m_dispatchingDidClearWindowObjectInMainWorld(false)
176 , m_protectProvisionalLoader(false) 175 , m_protectProvisionalLoader(false)
177 { 176 {
178 TRACE_EVENT_OBJECT_CREATED_WITH_ID("loading", "FrameLoader", this); 177 TRACE_EVENT_OBJECT_CREATED_WITH_ID("loading", "FrameLoader", this);
179 takeObjectSnapshot(); 178 takeObjectSnapshot();
180 } 179 }
181 180
182 FrameLoader::~FrameLoader() 181 FrameLoader::~FrameLoader()
183 { 182 {
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 1053
1055 m_inStopAllLoaders = false; 1054 m_inStopAllLoaders = false;
1056 takeObjectSnapshot(); 1055 takeObjectSnapshot();
1057 } 1056 }
1058 1057
1059 void FrameLoader::didAccessInitialDocument() 1058 void FrameLoader::didAccessInitialDocument()
1060 { 1059 {
1061 // We only need to notify the client once, and only for the main frame. 1060 // We only need to notify the client once, and only for the main frame.
1062 if (isLoadingMainFrame() && !m_didAccessInitialDocument) { 1061 if (isLoadingMainFrame() && !m_didAccessInitialDocument) {
1063 m_didAccessInitialDocument = true; 1062 m_didAccessInitialDocument = true;
1064 // Notify asynchronously, since this is called within a JavaScript secur ity check. 1063
1065 m_didAccessInitialDocumentTimer.startOneShot(0, BLINK_FROM_HERE); 1064 // Forbid script execution to prevent re-entering V8, since this is
1065 // called from a binding security check.
1066 ScriptForbiddenScope forbidScripts;
1067 if (client())
1068 client()->didAccessInitialDocument();
1066 } 1069 }
1067 } 1070 }
1068 1071
1069 void FrameLoader::didAccessInitialDocumentTimerFired(Timer<FrameLoader>*)
1070 {
1071 if (client())
1072 client()->didAccessInitialDocument();
1073 }
1074
1075 void FrameLoader::notifyIfInitialDocumentAccessed()
1076 {
1077 if (m_didAccessInitialDocumentTimer.isActive()) {
1078 m_didAccessInitialDocumentTimer.stop();
1079 didAccessInitialDocumentTimerFired(0);
1080 }
1081 }
1082
1083 bool FrameLoader::prepareForCommit() 1072 bool FrameLoader::prepareForCommit()
1084 { 1073 {
1085 PluginScriptForbiddenScope forbidPluginDestructorScripting; 1074 PluginScriptForbiddenScope forbidPluginDestructorScripting;
1086 DocumentLoader* pdl = m_provisionalDocumentLoader; 1075 DocumentLoader* pdl = m_provisionalDocumentLoader;
1087 1076
1088 if (m_frame->document()) { 1077 if (m_frame->document()) {
1089 unsigned nodeCount = 0; 1078 unsigned nodeCount = 0;
1090 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext() ) { 1079 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext() ) {
1091 if (frame->isLocalFrame()) { 1080 if (frame->isLocalFrame()) {
1092 LocalFrame* localFrame = toLocalFrame(frame); 1081 LocalFrame* localFrame = toLocalFrame(frame);
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String()); 1605 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String());
1617 return tracedValue; 1606 return tracedValue;
1618 } 1607 }
1619 1608
1620 inline void FrameLoader::takeObjectSnapshot() const 1609 inline void FrameLoader::takeObjectSnapshot() const
1621 { 1610 {
1622 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value()); 1611 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value());
1623 } 1612 }
1624 1613
1625 } // namespace blink 1614 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameLoader.h ('k') | third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698