| 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 "web/WebRemoteFrameImpl.h" | 5 #include "web/WebRemoteFrameImpl.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/html/HTMLFrameOwnerElement.h" | 9 #include "core/html/HTMLFrameOwnerElement.h" |
| 10 #include "core/layout/LayoutObject.h" | 10 #include "core/layout/LayoutObject.h" |
| 11 #include "core/page/Page.h" | 11 #include "core/page/Page.h" |
| 12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 13 #include "public/platform/WebFloatRect.h" | 13 #include "public/platform/WebFloatRect.h" |
| 14 #include "public/platform/WebRect.h" | 14 #include "public/platform/WebRect.h" |
| 15 #include "public/web/WebDocument.h" | 15 #include "public/web/WebDocument.h" |
| 16 #include "public/web/WebFrameOwnerProperties.h" | 16 #include "public/web/WebFrameOwnerProperties.h" |
| 17 #include "public/web/WebPerformance.h" | 17 #include "public/web/WebPerformance.h" |
| 18 #include "public/web/WebRange.h" | 18 #include "public/web/WebRange.h" |
| 19 #include "public/web/WebTreeScopeType.h" | 19 #include "public/web/WebTreeScopeType.h" |
| 20 #include "web/RemoteBridgeFrameOwner.h" | 20 #include "web/RemoteFrameOwner.h" |
| 21 #include "web/WebLocalFrameImpl.h" | 21 #include "web/WebLocalFrameImpl.h" |
| 22 #include "web/WebViewImpl.h" | 22 #include "web/WebViewImpl.h" |
| 23 #include <v8/include/v8.h> | 23 #include <v8/include/v8.h> |
| 24 | 24 |
| 25 namespace blink { | 25 namespace blink { |
| 26 | 26 |
| 27 WebRemoteFrame* WebRemoteFrame::create(WebTreeScopeType scope, WebRemoteFrameCli
ent* client, WebFrame* opener) | 27 WebRemoteFrame* WebRemoteFrame::create(WebTreeScopeType scope, WebRemoteFrameCli
ent* client, WebFrame* opener) |
| 28 { | 28 { |
| 29 return WebRemoteFrameImpl::create(scope, client, opener); | 29 return WebRemoteFrameImpl::create(scope, client, opener); |
| 30 } | 30 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 42 | 42 |
| 43 WebRemoteFrameImpl::~WebRemoteFrameImpl() | 43 WebRemoteFrameImpl::~WebRemoteFrameImpl() |
| 44 { | 44 { |
| 45 } | 45 } |
| 46 | 46 |
| 47 #if ENABLE(OILPAN) | 47 #if ENABLE(OILPAN) |
| 48 DEFINE_TRACE(WebRemoteFrameImpl) | 48 DEFINE_TRACE(WebRemoteFrameImpl) |
| 49 { | 49 { |
| 50 visitor->trace(m_frameClient); | 50 visitor->trace(m_frameClient); |
| 51 visitor->trace(m_frame); | 51 visitor->trace(m_frame); |
| 52 visitor->trace(m_ownersForChildren); | |
| 53 visitor->template registerWeakMembers<WebFrame, &WebFrame::clearWeakFrames>(
this); | 52 visitor->template registerWeakMembers<WebFrame, &WebFrame::clearWeakFrames>(
this); |
| 54 WebFrame::traceFrames(visitor, this); | 53 WebFrame::traceFrames(visitor, this); |
| 55 WebFrameImplBase::trace(visitor); | 54 WebFrameImplBase::trace(visitor); |
| 56 } | 55 } |
| 57 #endif | 56 #endif |
| 58 | 57 |
| 59 bool WebRemoteFrameImpl::isWebLocalFrame() const | 58 bool WebRemoteFrameImpl::isWebLocalFrame() const |
| 60 { | 59 { |
| 61 return false; | 60 return false; |
| 62 } | 61 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 return false; | 167 return false; |
| 169 } | 168 } |
| 170 | 169 |
| 171 WebView* WebRemoteFrameImpl::view() const | 170 WebView* WebRemoteFrameImpl::view() const |
| 172 { | 171 { |
| 173 if (!frame()) | 172 if (!frame()) |
| 174 return nullptr; | 173 return nullptr; |
| 175 return WebViewImpl::fromPage(frame()->page()); | 174 return WebViewImpl::fromPage(frame()->page()); |
| 176 } | 175 } |
| 177 | 176 |
| 178 void WebRemoteFrameImpl::removeChild(WebFrame* frame) | |
| 179 { | |
| 180 WebFrame::removeChild(frame); | |
| 181 m_ownersForChildren.remove(frame); | |
| 182 } | |
| 183 | |
| 184 WebDocument WebRemoteFrameImpl::document() const | 177 WebDocument WebRemoteFrameImpl::document() const |
| 185 { | 178 { |
| 186 // TODO(dcheng): this should also ASSERT_NOT_REACHED, but a lot of | 179 // TODO(dcheng): this should also ASSERT_NOT_REACHED, but a lot of |
| 187 // code tries to access the document of a remote frame at the moment. | 180 // code tries to access the document of a remote frame at the moment. |
| 188 return WebDocument(); | 181 return WebDocument(); |
| 189 } | 182 } |
| 190 | 183 |
| 191 WebPerformance WebRemoteFrameImpl::performance() const | 184 WebPerformance WebRemoteFrameImpl::performance() const |
| 192 { | 185 { |
| 193 ASSERT_NOT_REACHED(); | 186 ASSERT_NOT_REACHED(); |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 | 591 |
| 599 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const | 592 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const |
| 600 { | 593 { |
| 601 ASSERT_NOT_REACHED(); | 594 ASSERT_NOT_REACHED(); |
| 602 return WebString(); | 595 return WebString(); |
| 603 } | 596 } |
| 604 | 597 |
| 605 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(WebTreeScopeType scope, cons
t WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags, We
bFrameClient* client, WebFrame* previousSibling, const WebFrameOwnerProperties&
frameOwnerProperties, WebFrame* opener) | 598 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(WebTreeScopeType scope, cons
t WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags, We
bFrameClient* client, WebFrame* previousSibling, const WebFrameOwnerProperties&
frameOwnerProperties, WebFrame* opener) |
| 606 { | 599 { |
| 607 WebLocalFrameImpl* child = WebLocalFrameImpl::create(scope, client, opener); | 600 WebLocalFrameImpl* child = WebLocalFrameImpl::create(scope, client, opener); |
| 608 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = | |
| 609 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(static_cas
t<SandboxFlags>(sandboxFlags), frameOwnerProperties)); | |
| 610 insertAfter(child, previousSibling); | 601 insertAfter(child, previousSibling); |
| 602 RefPtrWillBeRawPtr<RemoteFrameOwner> owner = RemoteFrameOwner::create(static
_cast<SandboxFlags>(sandboxFlags), frameOwnerProperties); |
| 611 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame,
which may | 603 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame,
which may |
| 612 // result in the browser observing two navigations to about:blank (one from
the initial | 604 // result in the browser observing two navigations to about:blank (one from
the initial |
| 613 // frame creation, and one from swapping it into the remote process). FrameL
oader might | 605 // frame creation, and one from swapping it into the remote process). FrameL
oader might |
| 614 // need a special initialization function for this case to avoid that duplic
ate navigation. | 606 // need a special initialization function for this case to avoid that duplic
ate navigation. |
| 615 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, uniqueName); | 607 child->initializeCoreFrame(frame()->host(), owner.get(), name, uniqueName); |
| 616 // Partially related with the above FIXME--the init() call may trigger JS di
spatch. However, | 608 // Partially related with the above FIXME--the init() call may trigger JS di
spatch. However, |
| 617 // if the parent is remote, it should never be detached synchronously... | 609 // if the parent is remote, it should never be detached synchronously... |
| 618 ASSERT(child->frame()); | 610 ASSERT(child->frame()); |
| 619 return child; | 611 return child; |
| 620 } | 612 } |
| 621 | 613 |
| 622 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name, const AtomicString& uniqueName) | 614 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name, const AtomicString& uniqueName) |
| 623 { | 615 { |
| 624 setCoreFrame(RemoteFrame::create(m_frameClient.get(), host, owner)); | 616 setCoreFrame(RemoteFrame::create(m_frameClient.get(), host, owner)); |
| 625 frame()->createView(); | 617 frame()->createView(); |
| 626 m_frame->tree().setPrecalculatedName(name, uniqueName); | 618 m_frame->tree().setPrecalculatedName(name, uniqueName); |
| 627 } | 619 } |
| 628 | 620 |
| 629 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(WebTreeScopeType scope, co
nst WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags,
WebRemoteFrameClient* client, WebFrame* opener) | 621 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(WebTreeScopeType scope, co
nst WebString& name, const WebString& uniqueName, WebSandboxFlags sandboxFlags,
WebRemoteFrameClient* client, WebFrame* opener) |
| 630 { | 622 { |
| 631 WebRemoteFrameImpl* child = WebRemoteFrameImpl::create(scope, client, opener
); | 623 WebRemoteFrameImpl* child = WebRemoteFrameImpl::create(scope, client, opener
); |
| 632 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = | |
| 633 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(static_cas
t<SandboxFlags>(sandboxFlags), WebFrameOwnerProperties())); | |
| 634 appendChild(child); | 624 appendChild(child); |
| 635 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, uniqueName); | 625 RefPtrWillBeRawPtr<RemoteFrameOwner> owner = RemoteFrameOwner::create(static
_cast<SandboxFlags>(sandboxFlags), WebFrameOwnerProperties()); |
| 626 child->initializeCoreFrame(frame()->host(), owner.get(), name, uniqueName); |
| 636 return child; | 627 return child; |
| 637 } | 628 } |
| 638 | 629 |
| 639 void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame) | 630 void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame) |
| 640 { | 631 { |
| 641 m_frame = frame; | 632 m_frame = frame; |
| 642 } | 633 } |
| 643 | 634 |
| 644 WebRemoteFrameImpl* WebRemoteFrameImpl::fromFrame(RemoteFrame& frame) | 635 WebRemoteFrameImpl* WebRemoteFrameImpl::fromFrame(RemoteFrame& frame) |
| 645 { | 636 { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 : WebRemoteFrame(scope) | 720 : WebRemoteFrame(scope) |
| 730 , m_frameClient(RemoteFrameClientImpl::create(this)) | 721 , m_frameClient(RemoteFrameClientImpl::create(this)) |
| 731 , m_client(client) | 722 , m_client(client) |
| 732 #if ENABLE(OILPAN) | 723 #if ENABLE(OILPAN) |
| 733 , m_selfKeepAlive(this) | 724 , m_selfKeepAlive(this) |
| 734 #endif | 725 #endif |
| 735 { | 726 { |
| 736 } | 727 } |
| 737 | 728 |
| 738 } // namespace blink | 729 } // namespace blink |
| OLD | NEW |