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

Unified Diff: third_party/WebKit/Source/core/frame/LocalFrame.cpp

Issue 2783543004: Move registration of LocalFrame mojo interfaces to ModulesInitializer. (Closed)
Patch Set: Move modules initialization to the first operation in LocalFrame::Init as the loader can actually d… Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/LocalFrame.cpp
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
index a43354bd3329f975d181fafc704c6bad85136a81..bd9cdd42e6a548259920b88c467287bbbaee44b6 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -240,6 +240,13 @@ inline float parentTextZoomFactor(LocalFrame* frame) {
return toLocalFrame(parent)->textZoomFactor();
}
+using FrameInitCallbackVector = WTF::Vector<LocalFrame::FrameInitCallback>;
+FrameInitCallbackVector& getInitializationVector() {
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(FrameInitCallbackVector, initializationVector,
+ new FrameInitCallbackVector());
+ return initializationVector;
+}
+
} // namespace
template class CORE_TEMPLATE_EXPORT Supplement<LocalFrame>;
@@ -259,6 +266,17 @@ LocalFrame* LocalFrame::create(LocalFrameClient* client,
return frame;
}
+void LocalFrame::init() {
+ // Initialization code needs to run first as the call to m_loader.init() can
+ // actually lead to this object being freed!
+ DCHECK(!getInitializationVector().isEmpty());
+ for (auto& initilizationCallback : getInitializationVector()) {
+ initilizationCallback(this);
+ }
+
+ m_loader.init();
+}
+
void LocalFrame::setView(FrameView* view) {
ASSERT(!m_view || m_view != view);
ASSERT(!document() || !document()->isActive());
@@ -831,6 +849,10 @@ bool LocalFrame::shouldThrottleRendering() const {
return view() && view()->shouldThrottleRendering();
}
+void LocalFrame::registerInitializationCallback(FrameInitCallback callback) {
+ getInitializationVector().push_back(callback);
+}
+
inline LocalFrame::LocalFrame(LocalFrameClient* client,
Page& page,
FrameOwner* owner,
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.h ('k') | third_party/WebKit/Source/modules/ModulesInitializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698