| 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 "config.h" | 5 #include "config.h" |
| 6 #include "web/WebRemoteFrameImpl.h" | 6 #include "web/WebRemoteFrameImpl.h" |
| 7 | 7 |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/RemoteFrame.h" | 9 #include "core/frame/RemoteFrame.h" |
| 10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.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/WebPerformance.h" | 16 #include "public/web/WebPerformance.h" |
| 17 #include "public/web/WebRange.h" | 17 #include "public/web/WebRange.h" |
| 18 #include "public/web/WebTreeScopeType.h" |
| 18 #include "web/RemoteBridgeFrameOwner.h" | 19 #include "web/RemoteBridgeFrameOwner.h" |
| 19 #include "web/WebViewImpl.h" | 20 #include "web/WebViewImpl.h" |
| 20 #include <v8/include/v8.h> | 21 #include <v8/include/v8.h> |
| 21 | 22 |
| 22 namespace blink { | 23 namespace blink { |
| 23 | 24 |
| 24 WebRemoteFrame* WebRemoteFrame::create(WebRemoteFrameClient* client) | 25 WebRemoteFrame* WebRemoteFrame::create(WebRemoteFrameClient* client) |
| 25 { | 26 { |
| 26 WebRemoteFrameImpl* frame = new WebRemoteFrameImpl(client); | 27 return WebRemoteFrame::create(WebTreeScopeType::Document, client); |
| 28 } |
| 29 |
| 30 WebRemoteFrame* WebRemoteFrame::create(WebTreeScopeType scope, WebRemoteFrameCli
ent* client) |
| 31 { |
| 32 return WebRemoteFrameImpl::create(scope, client); |
| 33 } |
| 34 |
| 35 WebRemoteFrame* WebRemoteFrameImpl::create(WebTreeScopeType scope, WebRemoteFram
eClient* client) |
| 36 { |
| 37 WebRemoteFrameImpl* frame = new WebRemoteFrameImpl(scope, client); |
| 27 #if ENABLE(OILPAN) | 38 #if ENABLE(OILPAN) |
| 28 return frame; | 39 return frame; |
| 29 #else | 40 #else |
| 30 return adoptRef(frame).leakRef(); | 41 return adoptRef(frame).leakRef(); |
| 31 #endif | 42 #endif |
| 32 } | 43 } |
| 33 | 44 |
| 34 WebRemoteFrameImpl::WebRemoteFrameImpl(WebRemoteFrameClient* client) | |
| 35 : m_frameClient(this) | |
| 36 , m_client(client) | |
| 37 #if ENABLE(OILPAN) | |
| 38 , m_selfKeepAlive(this) | |
| 39 #endif | |
| 40 { | |
| 41 } | |
| 42 | |
| 43 WebRemoteFrameImpl::~WebRemoteFrameImpl() | 45 WebRemoteFrameImpl::~WebRemoteFrameImpl() |
| 44 { | 46 { |
| 45 } | 47 } |
| 46 | 48 |
| 47 #if ENABLE(OILPAN) | 49 #if ENABLE(OILPAN) |
| 48 DEFINE_TRACE(WebRemoteFrameImpl) | 50 DEFINE_TRACE(WebRemoteFrameImpl) |
| 49 { | 51 { |
| 50 visitor->trace(m_frame); | 52 visitor->trace(m_frame); |
| 51 visitor->trace(m_ownersForChildren); | 53 visitor->trace(m_ownersForChildren); |
| 52 visitor->template registerWeakMembers<WebFrame, &WebFrame::clearWeakFrames>(
this); | 54 visitor->template registerWeakMembers<WebFrame, &WebFrame::clearWeakFrames>(
this); |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 } | 713 } |
| 712 | 714 |
| 713 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const | 715 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const |
| 714 { | 716 { |
| 715 ASSERT_NOT_REACHED(); | 717 ASSERT_NOT_REACHED(); |
| 716 return WebString(); | 718 return WebString(); |
| 717 } | 719 } |
| 718 | 720 |
| 719 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebSa
ndboxFlags sandboxFlags, WebFrameClient* client, WebFrame* previousSibling) | 721 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebSa
ndboxFlags sandboxFlags, WebFrameClient* client, WebFrame* previousSibling) |
| 720 { | 722 { |
| 721 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client)
); | 723 return createLocalChild(WebTreeScopeType::Document, name, sandboxFlags, clie
nt, previousSibling); |
| 724 } |
| 725 |
| 726 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(WebTreeScopeType scope, cons
t WebString& name, WebSandboxFlags sandboxFlags, WebFrameClient* client, WebFram
e* previousSibling) |
| 727 { |
| 728 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(scope,
client)); |
| 722 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = | 729 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = |
| 723 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(child, sta
tic_cast<SandboxFlags>(sandboxFlags))); | 730 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(child, sta
tic_cast<SandboxFlags>(sandboxFlags))); |
| 724 insertAfter(child, previousSibling); | 731 insertAfter(child, previousSibling); |
| 725 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame,
which may | 732 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame,
which may |
| 726 // result in the browser observing two navigations to about:blank (one from
the initial | 733 // result in the browser observing two navigations to about:blank (one from
the initial |
| 727 // frame creation, and one from swapping it into the remote process). FrameL
oader might | 734 // frame creation, and one from swapping it into the remote process). FrameL
oader might |
| 728 // need a special initialization function for this case to avoid that duplic
ate navigation. | 735 // need a special initialization function for this case to avoid that duplic
ate navigation. |
| 729 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, nullAtom); | 736 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name, nullAtom); |
| 730 // Partially related with the above FIXME--the init() call may trigger JS di
spatch. However, | 737 // Partially related with the above FIXME--the init() call may trigger JS di
spatch. However, |
| 731 // if the parent is remote, it should never be detached synchronously... | 738 // if the parent is remote, it should never be detached synchronously... |
| 732 ASSERT(child->frame()); | 739 ASSERT(child->frame()); |
| 733 return child; | 740 return child; |
| 734 } | 741 } |
| 735 | 742 |
| 743 |
| 736 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name) | 744 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
const AtomicString& name) |
| 737 { | 745 { |
| 738 setCoreFrame(RemoteFrame::create(&m_frameClient, host, owner)); | 746 setCoreFrame(RemoteFrame::create(&m_frameClient, host, owner)); |
| 739 frame()->createView(); | 747 frame()->createView(); |
| 740 m_frame->tree().setName(name, nullAtom); | 748 m_frame->tree().setName(name, nullAtom); |
| 741 } | 749 } |
| 742 | 750 |
| 743 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, Web
SandboxFlags sandboxFlags, WebRemoteFrameClient* client) | 751 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, Web
SandboxFlags sandboxFlags, WebRemoteFrameClient* client) |
| 744 { | 752 { |
| 745 WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(clie
nt)); | 753 return createRemoteChild(WebTreeScopeType::Document, name, sandboxFlags, cli
ent); |
| 754 } |
| 755 |
| 756 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(WebTreeScopeType scope, co
nst WebString& name, WebSandboxFlags sandboxFlags, WebRemoteFrameClient* client) |
| 757 { |
| 758 WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(scop
e, client)); |
| 746 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = | 759 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu
lt = |
| 747 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(nullptr, s
tatic_cast<SandboxFlags>(sandboxFlags))); | 760 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(nullptr, s
tatic_cast<SandboxFlags>(sandboxFlags))); |
| 748 appendChild(child); | 761 appendChild(child); |
| 749 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name); | 762 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(),
name); |
| 750 return child; | 763 return child; |
| 751 } | 764 } |
| 752 | 765 |
| 753 void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame) | 766 void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame) |
| 754 { | 767 { |
| 755 m_frame = frame; | 768 m_frame = frame; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 void WebRemoteFrameImpl::didStopLoading() | 816 void WebRemoteFrameImpl::didStopLoading() |
| 804 { | 817 { |
| 805 frame()->setIsLoading(false); | 818 frame()->setIsLoading(false); |
| 806 if (parent() && parent()->isWebLocalFrame()) { | 819 if (parent() && parent()->isWebLocalFrame()) { |
| 807 WebLocalFrameImpl* parentFrame = | 820 WebLocalFrameImpl* parentFrame = |
| 808 toWebLocalFrameImpl(parent()->toWebLocalFrame()); | 821 toWebLocalFrameImpl(parent()->toWebLocalFrame()); |
| 809 parentFrame->frame()->loader().checkCompleted(); | 822 parentFrame->frame()->loader().checkCompleted(); |
| 810 } | 823 } |
| 811 } | 824 } |
| 812 | 825 |
| 826 WebRemoteFrameImpl::WebRemoteFrameImpl(WebTreeScopeType scope, WebRemoteFrameCli
ent* client) |
| 827 : WebRemoteFrame(scope) |
| 828 , m_frameClient(this) |
| 829 , m_client(client) |
| 830 #if ENABLE(OILPAN) |
| 831 , m_selfKeepAlive(this) |
| 832 #endif |
| 833 { |
| 834 } |
| 835 |
| 813 } // namespace blink | 836 } // namespace blink |
| OLD | NEW |