| 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,
|
|
|