Chromium Code Reviews| Index: Source/web/WebRemoteFrameImpl.cpp |
| diff --git a/Source/web/WebRemoteFrameImpl.cpp b/Source/web/WebRemoteFrameImpl.cpp |
| index 7329c73b5ae3c64b5f26a65c2c1a306cdf061f61..4e4315c9a9dd4fd4aaad6088c6d02be91f9c1efa 100644 |
| --- a/Source/web/WebRemoteFrameImpl.cpp |
| +++ b/Source/web/WebRemoteFrameImpl.cpp |
| @@ -9,6 +9,7 @@ |
| #include "core/frame/RemoteFrame.h" |
| #include "core/frame/Settings.h" |
| #include "core/page/Page.h" |
| +#include "platform/heap/Handle.h" |
| #include "public/platform/WebFloatRect.h" |
| #include "public/platform/WebRect.h" |
| #include "public/web/WebDocument.h" |
| @@ -27,23 +28,37 @@ namespace { |
| // 1. Allows the local frame's loader to retrieve sandbox flags associated with |
| // its owner element in another process. |
| // 2. Trigger a load event on its owner element once it finishes a load. |
| -class RemoteBridgeFrameOwner : public FrameOwner { |
| +class RemoteBridgeFrameOwner : public NoBaseWillBeGarbageCollectedFinalized<RemoteBridgeFrameOwner>, public FrameOwner { |
| + WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RemoteBridgeFrameOwner); |
| public: |
| - explicit RemoteBridgeFrameOwner(PassRefPtr<WebLocalFrameImpl>); |
| + static PassOwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> create(PassRefPtrWillBeRawPtr<WebLocalFrameImpl> frame) |
| + { |
| + return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(frame)); |
| + } |
| virtual bool isLocal() const OVERRIDE; |
| virtual SandboxFlags sandboxFlags() const OVERRIDE; |
| virtual void dispatchLoad() OVERRIDE; |
| + virtual void trace(Visitor*); |
| + |
| private: |
| - RefPtr<WebLocalFrameImpl> m_frame; |
| + explicit RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl>); |
| + |
| + RefPtrWillBeMember<WebLocalFrameImpl> m_frame; |
| }; |
| -RemoteBridgeFrameOwner::RemoteBridgeFrameOwner(PassRefPtr<WebLocalFrameImpl> frame) |
| +RemoteBridgeFrameOwner::RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl> frame) |
| : m_frame(frame) |
| { |
| } |
| +void RemoteBridgeFrameOwner::trace(Visitor* visitor) |
| +{ |
| + visitor->trace(m_frame); |
| + FrameOwner::trace(visitor); |
| +} |
| + |
| bool RemoteBridgeFrameOwner::isLocal() const |
| { |
| return false; |
| @@ -67,7 +82,8 @@ void RemoteBridgeFrameOwner::dispatchLoad() |
| // the RemoteFrame itself load a document). In most circumstances, the check for |
| // frame->owner() can be replaced with a check for frame->tree().parent(). Once |
| // that's done, this class can be removed. |
| -class PlaceholderFrameOwner : public FrameOwner { |
| +class PlaceholderFrameOwner : public NoBaseWillBeGarbageCollectedFinalized<PlaceholderFrameOwner>, public FrameOwner { |
| + WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PlaceholderFrameOwner); |
| public: |
| virtual bool isLocal() const OVERRIDE; |
| virtual SandboxFlags sandboxFlags() const OVERRIDE; |
| @@ -94,7 +110,12 @@ void PlaceholderFrameOwner::dispatchLoad() |
| WebRemoteFrame* WebRemoteFrame::create(WebFrameClient*) |
| { |
| - return adoptRef(new WebRemoteFrameImpl()).leakRef(); |
| + WebRemoteFrameImpl* frame = new WebRemoteFrameImpl(); |
| +#if ENABLE(OILPAN) |
| + return frame; |
| +#else |
| + return adoptRef(frame).leakRef(); |
|
haraken
2014/09/08 07:25:59
The same question as the WebLocalFrameImpl: In oil
sof
2014/09/08 21:17:46
Same place, via WebViewImpl's use of Persistent<>s
|
| +#endif |
| } |
| WebRemoteFrameImpl::WebRemoteFrameImpl() |
| @@ -106,6 +127,16 @@ WebRemoteFrameImpl::~WebRemoteFrameImpl() |
| { |
| } |
| +void WebRemoteFrameImpl::trace(Visitor* visitor) |
| +{ |
| +#if ENABLE(OILPAN) |
| + visitor->trace(m_frame); |
| + visitor->trace(m_ownersForChildren); |
| + |
| + WebFrame::trace(visitor, this); |
| +#endif |
| +} |
| + |
| bool WebRemoteFrameImpl::isWebLocalFrame() const |
| { |
| return false; |
| @@ -129,7 +160,12 @@ WebRemoteFrame* WebRemoteFrameImpl::toWebRemoteFrame() |
| void WebRemoteFrameImpl::close() |
| { |
| +#if ENABLE(OILPAN) |
| + if (m_frame) |
| + m_frame->setHasBeenClosed(); |
| +#else |
| deref(); |
| +#endif |
| } |
| WebString WebRemoteFrameImpl::uniqueName() const |
| @@ -797,8 +833,8 @@ WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const |
| WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebFrameClient* client) |
| { |
| WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client)); |
| - HashMap<WebFrame*, OwnPtr<FrameOwner> >::AddResult result = |
| - m_ownersForChildren.add(child, adoptPtr(new RemoteBridgeFrameOwner(child))); |
| + WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner> >::AddResult result = |
| + m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(child)); |
| appendChild(child); |
| // FIXME: currently this calls LocalFrame::init() on the created LocalFrame, which may |
| // result in the browser observing two navigations to about:blank (one from the initial |
| @@ -820,14 +856,14 @@ void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner, |
| WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, WebFrameClient* client) |
| { |
| WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(client)); |
| - HashMap<WebFrame*, OwnPtr<FrameOwner> >::AddResult result = |
| - m_ownersForChildren.add(child, adoptPtr(new PlaceholderFrameOwner)); |
| + WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner> >::AddResult result = |
| + m_ownersForChildren.add(child, adoptPtrWillBeNoop(new PlaceholderFrameOwner)); |
| appendChild(child); |
| child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(), name); |
| return child; |
| } |
| -void WebRemoteFrameImpl::setCoreFrame(PassRefPtr<RemoteFrame> frame) |
| +void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame) |
| { |
| m_frame = frame; |
| } |
| @@ -840,4 +876,3 @@ WebRemoteFrameImpl* WebRemoteFrameImpl::fromFrame(RemoteFrame& frame) |
| } |
| } // namespace blink |
| - |