Bug 1331389 - Add some documentation for various protocols. r?dvander draft
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 16 Jan 2017 10:51:43 -0500
changeset 461356 159034d3267e436d537353b80689ba7d5ed747b8
parent 461352 7884f9ed756bad6e9d73b8a5adb82d0773daae08
child 542307 8511111d010c8cfdf078cd063b509afb7f9b65b2
push id41662
push userkgupta@mozilla.com
push dateMon, 16 Jan 2017 15:52:09 +0000
reviewersdvander
bugs1331389
milestone53.0a1
Bug 1331389 - Add some documentation for various protocols. r?dvander MozReview-Commit-ID: J6NRYQLiy3q
dom/ipc/PContent.ipdl
gfx/layers/ipc/PCompositorBridge.ipdl
gfx/layers/ipc/PLayerTransaction.ipdl
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -338,16 +338,21 @@ struct GMPAPITags
 
 struct GMPCapabilityData
 {
     nsCString name;
     nsCString version;
     GMPAPITags[] capabilities;
 };
 
+/**
+ * The PContent protocol is a top-level protocol between the UI process
+ * and a content process. There is exactly one PContentParent/PContentChild pair
+ * for each content process.
+ */
 nested(upto inside_cpow) sync protocol PContent
 {
     parent spawns PPluginModule;
 
     parent opens PGMPService;
     child opens PBackground;
 
     manages PBlob;
--- a/gfx/layers/ipc/PCompositorBridge.ipdl
+++ b/gfx/layers/ipc/PCompositorBridge.ipdl
@@ -35,19 +35,39 @@ using class mozilla::layers::FrameUnifor
 using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
 using mozilla::layers::CompositorOptions from "mozilla/layers/CompositorOptions.h";
 
 namespace mozilla {
 namespace layers {
 
 
 /**
- * The PCompositorBridge protocol is used to manage communication between
- * the main thread and the compositor thread context. It's primary
- * purpose is to manage the PLayerTransaction sub protocol.
+ * The PCompositorBridge protocol is a top-level protocol for the compositor.
+ * There is an instance of the protocol for each compositor, plus one for each
+ * content process. In other words:
+ * - There is a CompositorBridgeParent/CompositorBridgeChild pair created
+ *   for each "top level browser window", which has its own compositor. The
+ *   CompositorBridgeChild instance lives in the UI process, and the
+ *   CompositorBridgeParent lives in the GPU process (if there is one) or the
+ *   UI process otherwise.
+ * - There is also a CrossProcessCompositorBridgeParent/CompositorBridgeChild
+ *   pair created for each content process. The CrossProcessCompositorBridgeParent
+ *   lives in the GPU process (if there is one) or the UI process otherwise. The
+ *   CompositorBridgeChild is a singleton in the content process. Note that
+ *   a given content process may have multiple browser instances (represented
+ *   by TabChild instances), that are attached to different windows, and therefore
+ *   rendered by different compositors. This means that when a browser instance
+ *   sends messages via its CompositorBridgeChild, the corresponding
+ *   CrossProcessCompositorBridgeParent has to use the layers id in the message
+ *   to find the correct compositor or CompositorBridgeParent to pass the message
+ *   on to.
+ *
+ * One of the main goals of this protocol is to manage the PLayerTransaction sub-
+ * protocol, which is per-browser. A lot of the functions in the protocol are
+ * basically multiplexing/demultiplexing stuff in PLayerTransaction.
  */
 sync protocol PCompositorBridge
 {
   manages PAPZ;
   manages PAPZCTreeManager;
   // A Compositor manages a single Layer Manager (PLayerTransaction)
   manages PLayerTransaction;
   manages PTexture;
--- a/gfx/layers/ipc/PLayerTransaction.ipdl
+++ b/gfx/layers/ipc/PLayerTransaction.ipdl
@@ -33,16 +33,24 @@ using mozilla::layers::LayerHandle from 
 namespace mozilla {
 namespace layers {
 
 union MaybeTransform {
   Matrix4x4;
   void_t;
 };
 
+/**
+ * The PLayerTransaction protocol manages the layer tree for a single "browser".
+ * The "browser" can be a top-level browser window, in which case the PLayer-
+ * TransactionChild exists in the UI process. The "browser" can also be a content
+ * tab, in which case the PLayerTransactionChild exists in the content process.
+ * In either case, the PLayerTransactionParent exists in the GPU process (if
+ * there is one) or the UI process otherwise.
+ */
 sync protocol PLayerTransaction {
   manager PCompositorBridge;
   manages PCompositable;
 
 parent:
   async PCompositable(TextureInfo aTextureInfo);
 
   // The isFirstPaint flag can be used to indicate that this is the first update