Index: Source/web/WebRemoteFrameImpl.cpp |
diff --git a/Source/web/WebRemoteFrameImpl.cpp b/Source/web/WebRemoteFrameImpl.cpp |
index 6bb811146337a1dbdf913f1fe46aaeea58f9e8de..ddd1552ed65134b927d39c4eb5d2d695ba96b064 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,12 +110,20 @@ void PlaceholderFrameOwner::dispatchLoad() |
WebRemoteFrame* WebRemoteFrame::create(WebRemoteFrameClient* client) |
{ |
- return adoptRef(new WebRemoteFrameImpl(client)).leakRef(); |
+ WebRemoteFrameImpl* frame = new WebRemoteFrameImpl(client); |
+#if ENABLE(OILPAN) |
+ return frame; |
+#else |
+ return adoptRef(frame).leakRef(); |
+#endif |
} |
WebRemoteFrameImpl::WebRemoteFrameImpl(WebRemoteFrameClient* client) |
: m_frameClient(this) |
, m_client(client) |
+#if ENABLE(OILPAN) |
+ , m_selfKeepAlive(this) |
+#endif |
{ |
} |
@@ -107,6 +131,16 @@ WebRemoteFrameImpl::~WebRemoteFrameImpl() |
{ |
} |
+void WebRemoteFrameImpl::trace(Visitor* visitor) |
+{ |
+#if ENABLE(OILPAN) |
+ visitor->trace(m_frame); |
+ visitor->trace(m_ownersForChildren); |
+ |
+ WebFrame::traceChildren(visitor, this); |
+#endif |
+} |
+ |
bool WebRemoteFrameImpl::isWebLocalFrame() const |
{ |
return false; |
@@ -130,7 +164,11 @@ WebRemoteFrame* WebRemoteFrameImpl::toWebRemoteFrame() |
void WebRemoteFrameImpl::close() |
{ |
+#if ENABLE(OILPAN) |
+ m_selfKeepAlive.clear(); |
+#else |
deref(); |
+#endif |
} |
WebString WebRemoteFrameImpl::uniqueName() const |
@@ -244,6 +282,13 @@ WebView* WebRemoteFrameImpl::view() const |
return WebViewImpl::fromPage(frame()->page()); |
} |
+WebViewImpl* WebRemoteFrameImpl::viewImpl() const |
+{ |
+ if (!frame()) |
+ return 0; |
+ return WebViewImpl::fromPage(frame()->page()); |
+} |
+ |
void WebRemoteFrameImpl::removeChild(WebFrame* frame) |
{ |
WebFrame::removeChild(frame); |
@@ -792,8 +837,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 |
@@ -815,14 +860,14 @@ void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner, |
WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, WebRemoteFrameClient* 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; |
} |