| 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 10 matching lines...) Expand all Loading... |
| 21 #include "web/RemoteFrameOwner.h" | 21 #include "web/RemoteFrameOwner.h" |
| 22 #include "web/WebLocalFrameImpl.h" | 22 #include "web/WebLocalFrameImpl.h" |
| 23 #include "web/WebRemoteFrameImpl.h" | 23 #include "web/WebRemoteFrameImpl.h" |
| 24 #include <algorithm> | 24 #include <algorithm> |
| 25 | 25 |
| 26 namespace blink { | 26 namespace blink { |
| 27 | 27 |
| 28 bool WebFrame::swap(WebFrame* frame) | 28 bool WebFrame::swap(WebFrame* frame) |
| 29 { | 29 { |
| 30 using std::swap; | 30 using std::swap; |
| 31 RawPtr<Frame> oldFrame = toImplBase()->frame(); | 31 Frame* oldFrame = toImplBase()->frame(); |
| 32 #if !ENABLE(OILPAN) | |
| 33 RefPtr<WebFrameImplBase> protectThis = toImplBase(); | |
| 34 #endif | |
| 35 | 32 |
| 36 // Unload the current Document in this frame: this calls unload handlers, | 33 // Unload the current Document in this frame: this calls unload handlers, |
| 37 // detaches child frames, etc. Since this runs script, make sure this frame | 34 // detaches child frames, etc. Since this runs script, make sure this frame |
| 38 // wasn't detached before continuing with the swap. | 35 // wasn't detached before continuing with the swap. |
| 39 // FIXME: There is no unit test for this condition, so one needs to be | 36 // FIXME: There is no unit test for this condition, so one needs to be |
| 40 // written. | 37 // written. |
| 41 if (!oldFrame->prepareForCommit()) | 38 if (!oldFrame->prepareForCommit()) |
| 42 return false; | 39 return false; |
| 43 | 40 |
| 44 if (m_parent) { | 41 if (m_parent) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 65 if (m_opener) { | 62 if (m_opener) { |
| 66 frame->setOpener(m_opener); | 63 frame->setOpener(m_opener); |
| 67 setOpener(nullptr); | 64 setOpener(nullptr); |
| 68 } | 65 } |
| 69 m_openedFrameTracker->transferTo(frame); | 66 m_openedFrameTracker->transferTo(frame); |
| 70 | 67 |
| 71 FrameHost* host = oldFrame->host(); | 68 FrameHost* host = oldFrame->host(); |
| 72 AtomicString name = oldFrame->tree().name(); | 69 AtomicString name = oldFrame->tree().name(); |
| 73 AtomicString uniqueName = oldFrame->tree().uniqueName(); | 70 AtomicString uniqueName = oldFrame->tree().uniqueName(); |
| 74 FrameOwner* owner = oldFrame->owner(); | 71 FrameOwner* owner = oldFrame->owner(); |
| 75 #if !ENABLE(OILPAN) | |
| 76 // Persistence of a remote frame owner is complicated in the pre-Oilpan | |
| 77 // world. Please see RemoteFrameOwner::setContentFrame() for the details. | |
| 78 RefPtr<RemoteFrameOwner> remoteOwnerProtector; | |
| 79 if (owner && owner->isRemote()) | |
| 80 remoteOwnerProtector = toRemoteFrameOwner(owner); | |
| 81 #endif | |
| 82 | 72 |
| 83 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); | 73 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
| 84 HashMap<DOMWrapperWorld*, v8::Local<v8::Object>> globals; | 74 HashMap<DOMWrapperWorld*, v8::Local<v8::Object>> globals; |
| 85 oldFrame->getWindowProxyManager()->clearForNavigation(); | 75 oldFrame->getWindowProxyManager()->clearForNavigation(); |
| 86 oldFrame->getWindowProxyManager()->releaseGlobals(globals); | 76 oldFrame->getWindowProxyManager()->releaseGlobals(globals); |
| 87 | 77 |
| 88 // Although the Document in this frame is now unloaded, many resources | 78 // Although the Document in this frame is now unloaded, many resources |
| 89 // associated with the frame itself have not yet been freed yet. | 79 // associated with the frame itself have not yet been freed yet. |
| 90 oldFrame->detach(FrameDetachType::Swap); | 80 oldFrame->detach(FrameDetachType::Swap); |
| 91 | 81 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 Frame* frame = toImplBase()->frame(); | 259 Frame* frame = toImplBase()->frame(); |
| 270 if (!frame) | 260 if (!frame) |
| 271 return 0; | 261 return 0; |
| 272 // FIXME: It's not clear this should ever be called to find a remote frame. | 262 // FIXME: It's not clear this should ever be called to find a remote frame. |
| 273 // Perhaps just disallow that completely? | 263 // Perhaps just disallow that completely? |
| 274 return fromFrame(frame->tree().child(name)); | 264 return fromFrame(frame->tree().child(name)); |
| 275 } | 265 } |
| 276 | 266 |
| 277 WebFrame* WebFrame::fromFrameOwnerElement(const WebElement& webElement) | 267 WebFrame* WebFrame::fromFrameOwnerElement(const WebElement& webElement) |
| 278 { | 268 { |
| 279 Element* element = RawPtr<Element>(webElement).get(); | 269 Element* element = webElement; |
| 280 | 270 |
| 281 if (!element->isFrameOwnerElement()) | 271 if (!element->isFrameOwnerElement()) |
| 282 return nullptr; | 272 return nullptr; |
| 283 return fromFrame(toHTMLFrameOwnerElement(element)->contentFrame()); | 273 return fromFrame(toHTMLFrameOwnerElement(element)->contentFrame()); |
| 284 } | 274 } |
| 285 | 275 |
| 286 bool WebFrame::isLoading() const | 276 bool WebFrame::isLoading() const |
| 287 { | 277 { |
| 288 if (Frame* frame = toImplBase()->frame()) | 278 if (Frame* frame = toImplBase()->frame()) |
| 289 return frame->isLoading(); | 279 return frame->isLoading(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 void WebFrame::traceFrames(VisitorDispatcher visitor, WebFrame* frame) { tra
ceFramesImpl(visitor, frame); } \ | 354 void WebFrame::traceFrames(VisitorDispatcher visitor, WebFrame* frame) { tra
ceFramesImpl(visitor, frame); } \ |
| 365 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI
mpl(visitor); } | 355 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI
mpl(visitor); } |
| 366 | 356 |
| 367 DEFINE_VISITOR_METHOD(Visitor*) | 357 DEFINE_VISITOR_METHOD(Visitor*) |
| 368 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) | 358 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) |
| 369 | 359 |
| 370 #undef DEFINE_VISITOR_METHOD | 360 #undef DEFINE_VISITOR_METHOD |
| 371 #endif | 361 #endif |
| 372 | 362 |
| 373 } // namespace blink | 363 } // namespace blink |
| OLD | NEW |