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/HTMLNames.h" | 8 #include "core/HTMLNames.h" |
9 #include "core/frame/FrameHost.h" | |
10 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
11 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
12 #include "core/frame/RemoteFrame.h" | 11 #include "core/frame/RemoteFrame.h" |
13 #include "core/html/HTMLFrameElementBase.h" | 12 #include "core/html/HTMLFrameElementBase.h" |
14 #include "core/html/HTMLFrameOwnerElement.h" | 13 #include "core/html/HTMLFrameOwnerElement.h" |
15 #include "core/page/Page.h" | 14 #include "core/page/Page.h" |
16 #include "platform/UserGestureIndicator.h" | 15 #include "platform/UserGestureIndicator.h" |
17 #include "platform/heap/Handle.h" | 16 #include "platform/heap/Handle.h" |
18 #include "platform/instrumentation/tracing/TraceEvent.h" | 17 #include "platform/instrumentation/tracing/TraceEvent.h" |
19 #include "public/web/WebElement.h" | 18 #include "public/web/WebElement.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 m_nextSibling->m_previousSibling = frame; | 60 m_nextSibling->m_previousSibling = frame; |
62 swap(m_nextSibling, frame->m_nextSibling); | 61 swap(m_nextSibling, frame->m_nextSibling); |
63 } | 62 } |
64 | 63 |
65 if (m_opener) { | 64 if (m_opener) { |
66 frame->setOpener(m_opener); | 65 frame->setOpener(m_opener); |
67 setOpener(nullptr); | 66 setOpener(nullptr); |
68 } | 67 } |
69 m_openedFrameTracker->transferTo(frame); | 68 m_openedFrameTracker->transferTo(frame); |
70 | 69 |
71 FrameHost* host = oldFrame->host(); | 70 Page* page = oldFrame->page(); |
72 AtomicString name = oldFrame->tree().name(); | 71 AtomicString name = oldFrame->tree().name(); |
73 FrameOwner* owner = oldFrame->owner(); | 72 FrameOwner* owner = oldFrame->owner(); |
74 | 73 |
75 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); | 74 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
76 WindowProxyManager::GlobalsVector globals; | 75 WindowProxyManager::GlobalsVector globals; |
77 oldFrame->getWindowProxyManager()->clearForNavigation(); | 76 oldFrame->getWindowProxyManager()->clearForNavigation(); |
78 oldFrame->getWindowProxyManager()->releaseGlobals(globals); | 77 oldFrame->getWindowProxyManager()->releaseGlobals(globals); |
79 | 78 |
80 // Although the Document in this frame is now unloaded, many resources | 79 // Although the Document in this frame is now unloaded, many resources |
81 // associated with the frame itself have not yet been freed yet. | 80 // associated with the frame itself have not yet been freed yet. |
(...skipping 16 matching lines...) Expand all Loading... |
98 if (owner->isLocal()) | 97 if (owner->isLocal()) |
99 toHTMLFrameOwnerElement(owner)->setWidget(localFrame.view()); | 98 toHTMLFrameOwnerElement(owner)->setWidget(localFrame.view()); |
100 } else { | 99 } else { |
101 localFrame.page()->setMainFrame(&localFrame); | 100 localFrame.page()->setMainFrame(&localFrame); |
102 // This trace event is needed to detect the main frame of the | 101 // This trace event is needed to detect the main frame of the |
103 // renderer in telemetry metrics. See crbug.com/692112#c11. | 102 // renderer in telemetry metrics. See crbug.com/692112#c11. |
104 TRACE_EVENT_INSTANT1("loading", "markAsMainFrame", | 103 TRACE_EVENT_INSTANT1("loading", "markAsMainFrame", |
105 TRACE_EVENT_SCOPE_THREAD, "frame", &localFrame); | 104 TRACE_EVENT_SCOPE_THREAD, "frame", &localFrame); |
106 } | 105 } |
107 } else { | 106 } else { |
108 toWebRemoteFrameImpl(frame)->initializeCoreFrame(host, owner, name); | 107 toWebRemoteFrameImpl(frame)->initializeCoreFrame(*page, owner, name); |
109 } | 108 } |
110 | 109 |
111 if (m_parent && oldFrame->hasReceivedUserGesture()) | 110 if (m_parent && oldFrame->hasReceivedUserGesture()) |
112 frame->toImplBase()->frame()->setDocumentHasReceivedUserGesture(); | 111 frame->toImplBase()->frame()->setDocumentHasReceivedUserGesture(); |
113 | 112 |
114 frame->toImplBase()->frame()->getWindowProxyManager()->setGlobals(globals); | 113 frame->toImplBase()->frame()->getWindowProxyManager()->setGlobals(globals); |
115 | 114 |
116 m_parent = nullptr; | 115 m_parent = nullptr; |
117 | 116 |
118 return true; | 117 return true; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 for (WebFrame* child = frame->firstChild(); child; | 309 for (WebFrame* child = frame->firstChild(); child; |
311 child = child->nextSibling()) | 310 child = child->nextSibling()) |
312 traceFrame(visitor, child); | 311 traceFrame(visitor, child); |
313 } | 312 } |
314 | 313 |
315 void WebFrame::close() { | 314 void WebFrame::close() { |
316 m_openedFrameTracker->dispose(); | 315 m_openedFrameTracker->dispose(); |
317 } | 316 } |
318 | 317 |
319 } // namespace blink | 318 } // namespace blink |
OLD | NEW |