Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1584)

Unified Diff: Source/web/WebRemoteFrameImpl.cpp

Issue 334483002: Add Blink APIs for frame tree mirroring. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix some more crashes, etc. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/web/WebRemoteFrameImpl.cpp
diff --git a/Source/web/WebRemoteFrameImpl.cpp b/Source/web/WebRemoteFrameImpl.cpp
index 12bc07a2ec9b0382bd6056d26758ead1eb82bbf5..e51c6fc3ef2d6b65c4b62a11792a6c66fc28b582 100644
--- a/Source/web/WebRemoteFrameImpl.cpp
+++ b/Source/web/WebRemoteFrameImpl.cpp
@@ -11,10 +11,96 @@
#include "public/web/WebDocument.h"
#include "public/web/WebPerformance.h"
#include "public/web/WebRange.h"
+#include "web/WebLocalFrameImpl.h"
+#include "web/WebViewImpl.h"
#include <v8/include/v8.h>
+using namespace WebCore;
+
namespace blink {
+namespace {
+
+class RemoteBridgeFrameOwner : public FrameOwner {
+public:
+ explicit RemoteBridgeFrameOwner(PassRefPtr<WebLocalFrameImpl>);
+
+ virtual bool isLocal() const OVERRIDE;
+ virtual void setContentFrame(Frame&) OVERRIDE;
+ virtual void clearContentFrame() OVERRIDE;
+ virtual SandboxFlags sandboxFlags() const OVERRIDE;
+ virtual void dispatchLoad() OVERRIDE;
+
+private:
+ RefPtr<WebLocalFrameImpl> m_frame;
+};
+
+RemoteBridgeFrameOwner::RemoteBridgeFrameOwner(PassRefPtr<WebLocalFrameImpl> frame)
+ : m_frame(frame)
+{
+}
+
+bool RemoteBridgeFrameOwner::isLocal() const
+{
+ return false;
+}
+
+void RemoteBridgeFrameOwner::setContentFrame(Frame&)
+{
+}
+
+void RemoteBridgeFrameOwner::clearContentFrame()
+{
+ delete this;
abarth-chromium 2014/06/13 18:06:46 delete this -> :( Is there really no object that
+}
+
+SandboxFlags RemoteBridgeFrameOwner::sandboxFlags() const
+{
+ // FIXME: Implement. Most likely grab it from m_frame.
+ return 0;
+}
+
+void RemoteBridgeFrameOwner::dispatchLoad()
+{
+ // FIXME: Implement. Most likely goes through m_frame->client().
+}
+
+class PlaceholderFrameOwner : public FrameOwner {
+public:
+ virtual bool isLocal() const OVERRIDE;
+ virtual void setContentFrame(Frame&) OVERRIDE;
+ virtual void clearContentFrame() OVERRIDE;
+ virtual SandboxFlags sandboxFlags() const OVERRIDE;
+ virtual void dispatchLoad() OVERRIDE;
+};
+
+bool PlaceholderFrameOwner::isLocal() const
+{
+ return false;
+}
+
+void PlaceholderFrameOwner::setContentFrame(Frame&)
+{
+}
+
+void PlaceholderFrameOwner::clearContentFrame()
+{
+ delete this;
abarth-chromium 2014/06/13 18:06:46 ditto
+}
+
+SandboxFlags PlaceholderFrameOwner::sandboxFlags() const
+{
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+void PlaceholderFrameOwner::dispatchLoad()
+{
+ ASSERT_NOT_REACHED();
+}
+
+} // namespace
+
WebRemoteFrame* WebRemoteFrame::create(WebFrameClient*)
{
return adoptRef(new WebRemoteFrameImpl()).leakRef();
@@ -162,6 +248,12 @@ WebView* WebRemoteFrameImpl::view() const
return 0;
}
+void WebRemoteFrameImpl::initializeAsMainFrame(WebView* view)
+{
+ Page* page = toWebViewImpl(view)->page();
+ setWebCoreFrame(RemoteFrame::create(&m_frameClient, &page->frameHost(), 0));
+}
+
WebFrame* WebRemoteFrameImpl::traversePrevious(bool wrap) const
{
ASSERT_NOT_REACHED();
@@ -722,5 +814,35 @@ WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const
return WebString();
}
+WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebFrameClient* client)
+{
+ WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client));
+ 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
+ // frame creation, and one from swapping it into the remote process). FrameLoader might
+ // need a special initialization function for this case to avoid that duplicate navigation.
+ child->initializeAsChildFrame(frame()->host(), new RemoteBridgeFrameOwner(child), name, AtomicString());
abarth-chromium 2014/06/13 18:06:46 adoptPtr(new RemoteBridgeFrameOwner(... ?
+ // Partially related with the above FIXME--the init() call may trigger JS dispatch. However,
+ // if the parent is remote, it should never be detached synchronously...
+ ASSERT(child->frame());
+ return child;
+}
+
+WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, WebFrameClient* client)
+{
+ WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(client));
+ appendChild(child);
+ RefPtr<RemoteFrame> childFrame = RemoteFrame::create(&child->m_frameClient, frame()->host(), new PlaceholderFrameOwner);
+ child->setWebCoreFrame(childFrame);
+ childFrame->tree().setName(name, AtomicString());
+ return child;
+}
+
+void WebRemoteFrameImpl::setWebCoreFrame(PassRefPtr<RemoteFrame> frame)
+{
+ m_frame = frame;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698