OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "public/web/WebFrame.h" | 5 #include "public/web/WebFrame.h" |
6 | 6 |
7 #include "bindings/core/v8/WindowProxyManager.h" | 7 #include "bindings/core/v8/WindowProxyManager.h" |
8 #include "core/frame/FrameHost.h" | 8 #include "core/frame/FrameHost.h" |
9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 m_openedFrameTracker->transferTo(frame); | 69 m_openedFrameTracker->transferTo(frame); |
70 | 70 |
71 FrameHost* host = oldFrame->host(); | 71 FrameHost* host = oldFrame->host(); |
72 AtomicString name = oldFrame->tree().name(); | 72 AtomicString name = oldFrame->tree().name(); |
73 AtomicString uniqueName = oldFrame->tree().uniqueName(); | 73 AtomicString uniqueName = oldFrame->tree().uniqueName(); |
74 FrameOwner* owner = oldFrame->owner(); | 74 FrameOwner* owner = oldFrame->owner(); |
75 oldFrame->disconnectOwnerElement(); | 75 oldFrame->disconnectOwnerElement(); |
76 | 76 |
77 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); | 77 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
78 HashMap<DOMWrapperWorld*, v8::Local<v8::Object>> globals; | 78 HashMap<DOMWrapperWorld*, v8::Local<v8::Object>> globals; |
79 oldFrame->windowProxyManager()->clearForNavigation(); | 79 oldFrame->getWindowProxyManager()->clearForNavigation(); |
80 oldFrame->windowProxyManager()->releaseGlobals(globals); | 80 oldFrame->getWindowProxyManager()->releaseGlobals(globals); |
81 | 81 |
82 // Although the Document in this frame is now unloaded, many resources | 82 // Although the Document in this frame is now unloaded, many resources |
83 // associated with the frame itself have not yet been freed yet. | 83 // associated with the frame itself have not yet been freed yet. |
84 oldFrame->detach(FrameDetachType::Swap); | 84 oldFrame->detach(FrameDetachType::Swap); |
85 | 85 |
86 // Finally, clone the state of the current Frame into one matching | 86 // Finally, clone the state of the current Frame into one matching |
87 // the type of the passed in WebFrame. | 87 // the type of the passed in WebFrame. |
88 // FIXME: This is a bit clunky; this results in pointless decrements and | 88 // FIXME: This is a bit clunky; this results in pointless decrements and |
89 // increments of connected subframes. | 89 // increments of connected subframes. |
90 if (frame->isWebLocalFrame()) { | 90 if (frame->isWebLocalFrame()) { |
91 LocalFrame& localFrame = *toWebLocalFrameImpl(frame)->frame(); | 91 LocalFrame& localFrame = *toWebLocalFrameImpl(frame)->frame(); |
92 ASSERT(owner == localFrame.owner()); | 92 ASSERT(owner == localFrame.owner()); |
93 if (owner) { | 93 if (owner) { |
94 if (owner->isLocal()) { | 94 if (owner->isLocal()) { |
95 HTMLFrameOwnerElement* ownerElement = toHTMLFrameOwnerElement(ow
ner); | 95 HTMLFrameOwnerElement* ownerElement = toHTMLFrameOwnerElement(ow
ner); |
96 ownerElement->setContentFrame(localFrame); | 96 ownerElement->setContentFrame(localFrame); |
97 ownerElement->setWidget(localFrame.view()); | 97 ownerElement->setWidget(localFrame.view()); |
98 } else { | 98 } else { |
99 toRemoteBridgeFrameOwner(owner)->setContentFrame(toWebLocalFrame
Impl(frame)); | 99 toRemoteBridgeFrameOwner(owner)->setContentFrame(toWebLocalFrame
Impl(frame)); |
100 } | 100 } |
101 } else { | 101 } else { |
102 localFrame.page()->setMainFrame(&localFrame); | 102 localFrame.page()->setMainFrame(&localFrame); |
103 } | 103 } |
104 } else { | 104 } else { |
105 toWebRemoteFrameImpl(frame)->initializeCoreFrame(host, owner, name, uniq
ueName); | 105 toWebRemoteFrameImpl(frame)->initializeCoreFrame(host, owner, name, uniq
ueName); |
106 } | 106 } |
107 | 107 |
108 frame->toImplBase()->frame()->windowProxyManager()->setGlobals(globals); | 108 frame->toImplBase()->frame()->getWindowProxyManager()->setGlobals(globals); |
109 | 109 |
110 m_parent = nullptr; | 110 m_parent = nullptr; |
111 | 111 |
112 return true; | 112 return true; |
113 } | 113 } |
114 | 114 |
115 void WebFrame::detach() | 115 void WebFrame::detach() |
116 { | 116 { |
117 toImplBase()->frame()->detach(FrameDetachType::Remove); | 117 toImplBase()->frame()->detach(FrameDetachType::Remove); |
118 } | 118 } |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 void WebFrame::traceFrames(VisitorDispatcher visitor, WebFrame* frame) { tra
ceFramesImpl(visitor, frame); } \ | 357 void WebFrame::traceFrames(VisitorDispatcher visitor, WebFrame* frame) { tra
ceFramesImpl(visitor, frame); } \ |
358 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI
mpl(visitor); } | 358 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI
mpl(visitor); } |
359 | 359 |
360 DEFINE_VISITOR_METHOD(Visitor*) | 360 DEFINE_VISITOR_METHOD(Visitor*) |
361 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) | 361 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) |
362 | 362 |
363 #undef DEFINE_VISITOR_METHOD | 363 #undef DEFINE_VISITOR_METHOD |
364 #endif | 364 #endif |
365 | 365 |
366 } // namespace blink | 366 } // namespace blink |
OLD | NEW |