#include "web/WebRemoteFrameImpl.h"
#include "core/frame/FrameOwner.h"
+#include "core/frame/FrameView.h"
#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"
// 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;
// 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;
} // namespace
-WebRemoteFrame* WebRemoteFrame::create(WebFrameClient*)
+WebRemoteFrame* WebRemoteFrame::create(WebRemoteFrameClient* client)
{
- return adoptRef(new WebRemoteFrameImpl()).leakRef();
+ WebRemoteFrameImpl* frame = new WebRemoteFrameImpl(client);
+#if ENABLE(OILPAN)
+ return frame;
+#else
+ return adoptRef(frame).leakRef();
+#endif
}
-WebRemoteFrameImpl::WebRemoteFrameImpl()
+WebRemoteFrameImpl::WebRemoteFrameImpl(WebRemoteFrameClient* client)
: m_frameClient(this)
+ , m_client(client)
+#if ENABLE(OILPAN)
+ , m_selfKeepAlive(this)
+#endif
{
}
{
}
+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;
void WebRemoteFrameImpl::close()
{
+#if ENABLE(OILPAN)
+ m_selfKeepAlive.clear();
+#else
deref();
+#endif
}
WebString WebRemoteFrameImpl::uniqueName() 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);
ASSERT_NOT_REACHED();
}
-bool WebRemoteFrameImpl::isLoading() const
-{
- ASSERT_NOT_REACHED();
- return false;
-}
-
void WebRemoteFrameImpl::stopLoading()
{
ASSERT_NOT_REACHED();
ASSERT_NOT_REACHED();
}
-void WebRemoteFrameImpl::sendOrientationChangeEvent()
-{
- ASSERT_NOT_REACHED();
-}
-
void WebRemoteFrameImpl::dispatchMessageEventWithOriginCheck(
const WebSecurityOrigin& intendedTargetOrigin,
const WebDOMEvent&)
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
m_frame->tree().setName(name, nullAtom);
}
-WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, WebFrameClient* client)
+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;
}
return static_cast<RemoteFrameClient*>(frame.client())->webFrame();
}
-} // namespace blink
+void WebRemoteFrameImpl::initializeFromFrame(WebLocalFrame* source) const
+{
+ ASSERT(source);
+ WebLocalFrameImpl* localFrameImpl = toWebLocalFrameImpl(source);
+ client()->initializeChildFrame(
+ localFrameImpl->frame()->view()->frameRect(),
+ localFrameImpl->frame()->view()->visibleContentScaleFactor());
+}
+} // namespace blink