Bug 570620, part n: Hook layout/ipc into the build system, and integrate PRenderFrame into the PBrowser family. sr=bsmedberg
authorChris Jones <jones.chris.g@gmail.com>
Fri, 20 Aug 2010 18:24:41 -0500
changeset 54018 e5bb865360bcaa9bf1ce13d0c91decacf537b4c5
parent 54017 ad761a2b81615a69bde9719bf025c21d447a586b
child 54019 9dfdccfd5bdcd2f100c8f1a88e61a429398498bf
push idunknown
push userunknown
push dateunknown
reviewersbsmedberg
bugs570620
milestone2.0b5pre
Bug 570620, part n: Hook layout/ipc into the build system, and integrate PRenderFrame into the PBrowser family. sr=bsmedberg
dom/ipc/PBrowser.ipdl
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
gfx/layers/ipc/PLayers.ipdl
gfx/layers/ipc/ShadowLayersChild.cpp
ipc/ipdl/Makefile.in
layout/Makefile.in
layout/base/Makefile.in
layout/build/Makefile.in
layout/ipc/Makefile.in
layout/ipc/ipdl.mk
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -39,16 +39,17 @@
 
 include protocol PContent;
 include protocol PContentDialog;
 include protocol PDocumentRenderer;
 include protocol PDocumentRendererShmem;
 include protocol PDocumentRendererNativeID;
 include protocol PGeolocationRequest;
 include protocol PExternalHelperApp;
+include protocol PRenderFrame;
 
 include "TabMessageUtils.h";
 include "gfxMatrix.h";
 include "mozilla/net/NeckoMessageUtils.h";
 include "IPC/nsGUIEventIPC.h";
 
 using gfxMatrix;
 using IPC::URI;
@@ -67,16 +68,17 @@ rpc protocol PBrowser
     manager PContent;
 
     manages PContentDialog;
     manages PDocumentRenderer;
     manages PDocumentRendererShmem;
     manages PDocumentRendererNativeID;
     manages PGeolocationRequest;
     manages PExternalHelperApp;
+    manages PRenderFrame;
 
 both:
     AsyncMessage(nsString aMessage, nsString aJSON);
 
 parent:
     /**
      * When child sends this message, parent should move focus to
      * the next or previous focusable element.
@@ -113,16 +115,22 @@ parent:
 
     QueryContentResult(nsQueryContentEvent event);
 
     PGeolocationRequest(URI uri);
 
     PContentDialog(PRUint32 aType, nsCString aName, nsCString aFeatures,
                    PRInt32[] aIntParams, nsString[] aStringParams);
 
+    /**
+     * Create a layout frame (encapsulating a remote layer tree) for
+     * the page that is currently loaded in the <browser>.
+     */
+    async PRenderFrame();
+
     __delete__();
 
     PExternalHelperApp(URI uri, nsCString aMimeContentType, bool aForceSave, PRInt64 aContentLength);
 
 child:
     /**
      * Notify the remote browser that it has been Show()n on this
      * side, with the given |visibleRect|.  This message is expected
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -34,16 +34,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "TabChild.h"
 #include "mozilla/dom/PContentChild.h"
 #include "mozilla/dom/PContentDialogChild.h"
+#include "mozilla/layout/RenderFrameChild.h"
 
 #include "nsIWebBrowser.h"
 #include "nsIWebBrowserSetup.h"
 #include "nsEmbedCID.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIBaseWindow.h"
 #include "nsIDOMWindow.h"
 #include "nsIWebProgress.h"
@@ -83,16 +84,17 @@
 #include "nsWeakReference.h"
 #include "nsISecureBrowserUI.h"
 #include "nsISSLStatusProvider.h"
 #include "nsSerializationHelper.h"
 #include "nsIFrame.h"
 #include "nsIView.h"
 
 using namespace mozilla::dom;
+using namespace mozilla::layout;
 
 NS_IMPL_ISUPPORTS1(ContentListener, nsIDOMEventListener)
 
 NS_IMETHODIMP
 ContentListener::HandleEvent(nsIDOMEvent* aEvent)
 {
   RemoteDOMEvent remoteEvent;
   remoteEvent.mEvent = do_QueryInterface(aEvent);
@@ -398,23 +400,25 @@ TabChild::ArraysToParams(const nsTArray<
       aParams->SetInt(i, aIntParams[i]);
     }
     for (PRInt32 j = 0; PRUint32(j) < aStringParams.Length(); ++j) {
       aParams->SetString(j, aStringParams[j].get());
     }
   }
 }
 
-
 void
 TabChild::DestroyWindow()
 {
     nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mWebNav);
     if (baseWindow)
         baseWindow->Destroy();
+
+    if (mWidget)
+        mWidget->Destroy();
 }
 
 void
 TabChild::ActorDestroy(ActorDestroyReason why)
 {
   // The messageManager relays messages via the TabChild which
   // no longer exists.
   static_cast<nsFrameMessageManager*>
@@ -1023,16 +1027,29 @@ TabChild::RecvDestroy()
   );
 
   // XXX what other code in ~TabChild() should we be running here?
   DestroyWindow();
 
   return Send__delete__(this);
 }
 
+PRenderFrameChild*
+TabChild::AllocPRenderFrame()
+{
+    return new RenderFrameChild();
+}
+
+bool
+TabChild::DeallocPRenderFrame(PRenderFrameChild* aFrame)
+{
+    delete aFrame;
+    return true;
+}
+
 bool
 TabChild::InitTabChildGlobal()
 {
   nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(mWebNav);
   NS_ENSURE_TRUE(window, false);
   nsCOMPtr<nsIDOMEventTarget> chromeHandler =
     do_QueryInterface(window->GetChromeEventHandler());
   NS_ENSURE_TRUE(chromeHandler, false);
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -285,16 +285,20 @@ public:
     nsIWebNavigation* WebNavigation() { return mWebNav; }
 
     JSContext* GetJSContext() { return mCx; }
 
     nsIPrincipal* GetPrincipal() { return mPrincipal; }
 
 protected:
     NS_OVERRIDE
+    virtual PRenderFrameChild* AllocPRenderFrame();
+    NS_OVERRIDE
+    virtual bool DeallocPRenderFrame(PRenderFrameChild* aFrame);
+    NS_OVERRIDE
     virtual bool RecvDestroy();
 
     bool DispatchWidgetEvent(nsGUIEvent& event);
 
 private:
     void ActorDestroy(ActorDestroyReason why);
 
     bool InitTabChildGlobal();
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -34,20 +34,21 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "mozilla/dom/ExternalHelperAppParent.h"
 #include "TabParent.h"
 
+#include "mozilla/dom/ContentParent.h"
 #include "mozilla/ipc/DocumentRendererParent.h"
 #include "mozilla/ipc/DocumentRendererShmemParent.h"
 #include "mozilla/ipc/DocumentRendererNativeIDParent.h"
-#include "mozilla/dom/ContentParent.h"
+#include "mozilla/layout/RenderFrameParent.h"
 
 #include "nsIURI.h"
 #include "nsFocusManager.h"
 #include "nsCOMPtr.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIDOMElement.h"
 #include "nsEventDispatcher.h"
 #include "nsIDOMEventTarget.h"
@@ -72,20 +73,19 @@
 #include "nsIContent.h"
 #include "mozilla/unused.h"
 
 #ifdef ANDROID
 #include "AndroidBridge.h"
 using namespace mozilla;
 #endif
 
-using mozilla::ipc::DocumentRendererParent;
-using mozilla::ipc::DocumentRendererShmemParent;
-using mozilla::ipc::DocumentRendererNativeIDParent;
-using mozilla::dom::ContentParent;
+using namespace mozilla::dom;
+using namespace mozilla::ipc;
+using namespace mozilla::layout;
 
 // The flags passed by the webProgress notifications are 16 bits shifted
 // from the ones registered by webProgressListeners.
 #define NOTIFY_FLAG_SHIFT 16
 
 namespace mozilla {
 namespace dom {
 
@@ -793,16 +793,30 @@ TabParent::HandleDelayedDialogs()
   }
   if (ShouldDelayDialogs() && mDelayedDialogs.Length()) {
     nsContentUtils::DispatchTrustedEvent(frame->GetOwnerDoc(), frame,
                                          NS_LITERAL_STRING("MozDelayedModalDialog"),
                                          PR_TRUE, PR_TRUE);
   }
 }
 
+PRenderFrameParent*
+TabParent::AllocPRenderFrame()
+{
+  nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
+  return new RenderFrameParent(frameLoader);
+}
+
+bool
+TabParent::DeallocPRenderFrame(PRenderFrameParent* aFrame)
+{
+  delete aFrame;
+  return true;
+}
+
 PRBool
 TabParent::ShouldDelayDialogs()
 {
   nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
   NS_ENSURE_TRUE(frameLoader, PR_TRUE);
   PRBool delay = PR_FALSE;
   frameLoader->GetDelayRemoteDialogs(&delay);
   return delay;
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -244,16 +244,21 @@ protected:
       nsCString mName;
       nsCString mFeatures;
       nsCOMPtr<nsIDialogParamBlock> mParams;
     };
     nsTArray<DelayedDialogData*> mDelayedDialogs;
 
     PRBool ShouldDelayDialogs();
 
+    NS_OVERRIDE
+    virtual PRenderFrameParent* AllocPRenderFrame();
+    NS_OVERRIDE
+    virtual bool DeallocPRenderFrame(PRenderFrameParent* aFrame);
+
     PRUint32 mSecurityState;
     nsString mSecurityTooltipText;
     nsCOMPtr<nsISupports> mSecurityStatusObject;
 
 private:
     already_AddRefed<nsFrameLoader> GetFrameLoader() const;
 };
 
--- a/gfx/layers/ipc/PLayers.ipdl
+++ b/gfx/layers/ipc/PLayers.ipdl
@@ -35,16 +35,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 //include protocol PCompositor;
 include protocol PLayer;
+include protocol PRenderFrame;
 
 using gfx3DMatrix;
 using gfxRGBA;
 using nsIntPoint;
 using nsIntRect;
 using nsIntRegion;
 using nsIntSize;
 using mozilla::GraphicsFilterType;
@@ -195,17 +196,17 @@ struct OpThebesBufferSwap {
 // only to be used for buffer swapping.
 union EditReply {
   OpBufferSwap;
 //  OpThebesBufferSwap;
 };
 
 
 sync protocol PLayers {
-  //manager PCompositor /*or PContent or PMedia or PPlugin*/;
+  manager PRenderFrame /*or PCompositor or PMedia or PPlugin*/;
   manages PLayer;
 
 parent:
   async PLayer();
 
   sync Update(Edit[] cset)
     returns (EditReply[] reply);
 
--- a/gfx/layers/ipc/ShadowLayersChild.cpp
+++ b/gfx/layers/ipc/ShadowLayersChild.cpp
@@ -44,20 +44,17 @@
 namespace mozilla {
 namespace layers {
 
 void
 ShadowLayersChild::Destroy()
 {
   NS_ABORT_IF_FALSE(0 == ManagedPLayerChild().Length(),
                     "layers should have been cleaned up by now");
-  //
-  // FIXME: uncomment this when we have a manager
-  //
-  //PLayersChild::Send__delete__(this);
+  PLayersChild::Send__delete__(this);
   // WARNING: |this| has gone to the great heap in the sky
 }
 
 PLayerChild*
 ShadowLayersChild::AllocPLayer()
 {
   // we always use the "power-user" ctor
   NS_RUNTIMEABORT("not reached");
--- a/ipc/ipdl/Makefile.in
+++ b/ipc/ipdl/Makefile.in
@@ -58,16 +58,17 @@ IPDLDIRS =  \
   dom/src/geolocation \
   dom/plugins  \
   dom/ipc  \
   gfx/layers/ipc \
   ipc/ipdl/test/cxx  \
   ipc/testshell  \
   js/ipc  \
   js/jetpack \
+  layout/ipc \
   netwerk/ipc  \
   netwerk/protocol/http  \
   netwerk/cookie  \
   $(NULL)
 ##-----------------------------------------------------------------------------
 
 ifdef MOZ_IPDL_TESTS
 DIRS += test
--- a/layout/Makefile.in
+++ b/layout/Makefile.in
@@ -53,16 +53,20 @@ PARALLEL_DIRS = \
 		xul/base/public \
 		xul/base/src \
 		$(NULL)
 
 ifdef NS_PRINTING
 PARALLEL_DIRS += printing
 endif
 
+ifdef MOZ_IPC
+PARALLEL_DIRS += ipc
+endif
+
 ifdef MOZ_MATHML
 PARALLEL_DIRS += \
   mathml \
   $(NULL)
 endif
 
 ifdef MOZ_SVG
 PARALLEL_DIRS += svg/base/src
--- a/layout/base/Makefile.in
+++ b/layout/base/Makefile.in
@@ -143,16 +143,20 @@ CPPSRCS		+= \
 		nsBidi.cpp \
 		$(NULL)
 endif                
 
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/config/rules.mk
 
+ifdef MOZ_IPC
+include $(topsrcdir)/ipc/chromium/chromium-config.mk
+endif
+
 LOCAL_INCLUDES += \
 		-I$(srcdir) \
 		-I$(srcdir)/../style \
 		-I$(srcdir)/../generic \
 		-I$(srcdir)/../forms \
 		-I$(srcdir)/../tables \
 		-I$(srcdir)/../printing \
 		-I$(srcdir)/../xul/base/src \
--- a/layout/build/Makefile.in
+++ b/layout/build/Makefile.in
@@ -77,20 +77,27 @@ CPPSRCS		= \
 		$(NULL)
 
 EXPORTS		= \
 		nsLayoutCID.h \
 		nsContentDLF.h \
 		nsLayoutStatics.h \
 		$(NULL)
 
+ifdef MOZ_IPC
+GKIPCLIB=../ipc/$(LIB_PREFIX)gkipc_s.$(LIB_SUFFIX)
+else
+GKIPCLIB=$(NULL)
+endif
+
 SHARED_LIBRARY_LIBS = \
 	../base/$(LIB_PREFIX)gkbase_s.$(LIB_SUFFIX) \
+	../forms/$(LIB_PREFIX)gkforms_s.$(LIB_SUFFIX) \
 	../generic/$(LIB_PREFIX)gkgeneric_s.$(LIB_SUFFIX) \
-	../forms/$(LIB_PREFIX)gkforms_s.$(LIB_SUFFIX) \
+	$(GKIPCLIB) \
 	../style/$(LIB_PREFIX)gkstyle_s.$(LIB_SUFFIX) \
 	../tables/$(LIB_PREFIX)gktable_s.$(LIB_SUFFIX) \
 	../xul/base/src/$(LIB_PREFIX)gkxulbase_s.$(LIB_SUFFIX) \
 	$(DEPTH)/content/base/src/$(LIB_PREFIX)gkconbase_s.$(LIB_SUFFIX) \
 	$(DEPTH)/content/canvas/src/$(LIB_PREFIX)gkconcvs_s.$(LIB_SUFFIX) \
 	$(DEPTH)/content/events/src/$(LIB_PREFIX)gkconevents_s.$(LIB_SUFFIX) \
 	$(DEPTH)/content/html/content/src/$(LIB_PREFIX)gkconhtmlcon_s.$(LIB_SUFFIX) \
 	$(DEPTH)/content/html/document/src/$(LIB_PREFIX)gkconhtmldoc_s.$(LIB_SUFFIX) \
new file mode 100644
--- /dev/null
+++ b/layout/ipc/Makefile.in
@@ -0,0 +1,71 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is Mozilla Firefox.
+#
+# The Initial Developer of the Original Code is
+# The Mozilla Foundation <http://www.mozilla.org/>.
+# Portions created by the Initial Developer are Copyright (C) 2010
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = layout
+LIBRARY_NAME = gkipc_s
+LIBXUL_LIBRARY = 1
+FORCE_STATIC_LIB = 1
+EXPORT_LIBRARY = 1
+
+EXPORTS_NAMESPACES = mozilla/layout
+
+EXPORTS_mozilla/layout = \
+  RenderFrameChild.h \
+  RenderFrameParent.h \
+  $(NULL)
+
+CPPSRCS = \
+  RenderFrameChild.cpp \
+  RenderFrameParent.cpp \
+  $(NULL)
+
+include $(topsrcdir)/config/config.mk
+include $(topsrcdir)/ipc/chromium/chromium-config.mk
+include $(topsrcdir)/config/rules.mk
+
+LOCAL_INCLUDES += \
+		-I$(topsrcdir)/content/base/src \
+		-I$(topsrcdir)/layout/base \
+		-I$(topsrcdir)/layout/generic \
+		-I$(topsrcdir)/layout/xul/base/src \
+		$(NULL)
new file mode 100644
--- /dev/null
+++ b/layout/ipc/ipdl.mk
@@ -0,0 +1,39 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is Mozilla Content App.
+#
+# The Initial Developer of the Original Code is
+#   The Mozilla Foundation.
+# Portions created by the Initial Developer are Copyright (C) 2009
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+IPDLSRCS = \
+  PRenderFrame.ipdl \
+  $(NULL)