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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2562323002: Devirtualize Frame::domWindow(). (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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 696a3f2a897752505930b541a4dc930940e74ff4..8be0ee4e17ee8f4bd46ba46dc494769f676102b9 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -409,7 +409,9 @@ Document::Document(const DocumentInit& initializer,
m_evaluateMediaQueriesOnStyleRecalc(false),
m_pendingSheetLayout(NoLayoutWithPendingSheets),
m_frame(initializer.frame()),
- m_domWindow(m_frame ? m_frame->localDOMWindow() : 0),
+ // TODO(dcheng): Why does this need both a LocalFrame and LocalDOMWindow
+ // pointer?
haraken 2016/12/12 09:54:59 I want to guarantee the following fact: - When a
dcheng 2016/12/12 10:21:39 Yes, that's basically not possible today: because
dcheng 2016/12/12 10:32:23 ALso, in a followup CL, I want to explore removing
haraken 2016/12/13 07:22:22 You're right that e.g., frame()->domWindow() shoul
+ m_domWindow(m_frame ? m_frame->domWindow() : nullptr),
m_importsController(this, initializer.importsController()),
m_contextFeatures(ContextFeatures::defaultSwitch()),
m_wellFormed(false),
@@ -499,10 +501,10 @@ Document::Document(const DocumentInit& initializer,
m_fetcher = m_frame->loader().documentLoader()->fetcher();
FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this);
+ // TODO(dcheng): Why does this need to check that DOMWindow is non-null?
CustomElementRegistry* registry =
- m_frame->localDOMWindow()
- ? m_frame->localDOMWindow()->maybeCustomElements()
- : nullptr;
+ m_frame->domWindow() ? m_frame->domWindow()->maybeCustomElements()
+ : nullptr;
if (registry && m_registrationContext)
registry->entangle(m_registrationContext);
} else if (m_importsController) {
@@ -3028,11 +3030,10 @@ void Document::dispatchUnloadEvents() {
DocumentLoadTiming& timing = documentLoader->timing();
DCHECK(timing.navigationStart());
timing.markUnloadEventStart();
- m_frame->localDOMWindow()->dispatchEvent(unloadEvent, this);
+ m_frame->domWindow()->dispatchEvent(unloadEvent, this);
timing.markUnloadEventEnd();
} else {
- m_frame->localDOMWindow()->dispatchEvent(unloadEvent,
- m_frame->document());
+ m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->document());
}
}
m_loadEventProgress = UnloadEventHandled;

Powered by Google App Engine
This is Rietveld 408576698