diff --git a/gfx/layers/apz/public/GeckoContentController.h b/gfx/layers/apz/public/GeckoContentController.h index 3149c0583233..dc9495c1e2d3 100644 --- a/gfx/layers/apz/public/GeckoContentController.h +++ b/gfx/layers/apz/public/GeckoContentController.h @@ -27,7 +27,11 @@ public: /** * Requests a paint of the given FrameMetrics |aFrameMetrics| from Gecko. * Implementations per-platform are responsible for actually handling this. - * This method will always be called on the Gecko main thread. + * + * This method must always be called on the repaint thread, which depends + * on the GeckoContentController. For ChromeProcessController it is the + * Gecko main thread, while for RemoteContentController it is the compositor + * thread where it can send IPDL messages. */ virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) = 0; diff --git a/gfx/layers/apz/util/ChromeProcessController.h b/gfx/layers/apz/util/ChromeProcessController.h index b8b4f90f11be..6222da1b2e66 100644 --- a/gfx/layers/apz/util/ChromeProcessController.h +++ b/gfx/layers/apz/util/ChromeProcessController.h @@ -24,8 +24,14 @@ namespace layers { class IAPZCTreeManager; class APZEventState; -// A ChromeProcessController is attached to the root of a compositor's layer -// tree. +/** + * ChromeProcessController is a GeckoContentController attached to the root of + * a compositor's layer tree. It's used directly by APZ by default, and remoted + * using PAPZ if there is a gpu process. + * + * If ChromeProcessController needs to implement a new method on GeckoContentController + * PAPZ, APZChild, and RemoteContentController must be updated to handle it. + */ class ChromeProcessController : public mozilla::layers::GeckoContentController { protected: diff --git a/gfx/layers/apz/util/ContentProcessController.h b/gfx/layers/apz/util/ContentProcessController.h index 2fb24262571d..5217c37b31a0 100644 --- a/gfx/layers/apz/util/ContentProcessController.h +++ b/gfx/layers/apz/util/ContentProcessController.h @@ -21,6 +21,17 @@ namespace layers { class APZChild; +/** + * ContentProcessController is a GeckoContentController for a TabChild, and is always + * remoted using PAPZ/APZChild. + * + * ContentProcessController is created in ContentChild when a layer tree id has + * been allocated for a PBrowser that lives in that content process, and is destroyed + * when the Destroy message is received, or when the tab dies. + * + * If ContentProcessController needs to implement a new method on GeckoContentController + * PAPZ, APZChild, and RemoteContentController must be updated to handle it. + */ class ContentProcessController final : public GeckoContentController { diff --git a/gfx/layers/ipc/APZChild.h b/gfx/layers/ipc/APZChild.h index 44cb8a2d21a0..b72013c70447 100644 --- a/gfx/layers/ipc/APZChild.h +++ b/gfx/layers/ipc/APZChild.h @@ -15,6 +15,10 @@ namespace layers { class GeckoContentController; +/** + * APZChild implements PAPZChild and is used to remote a GeckoContentController + * that lives in a different process than where APZ lives. + */ class APZChild final : public PAPZChild { public: diff --git a/gfx/layers/ipc/PAPZ.ipdl b/gfx/layers/ipc/PAPZ.ipdl index befcb5e72bef..b6396017fc42 100644 --- a/gfx/layers/ipc/PAPZ.ipdl +++ b/gfx/layers/ipc/PAPZ.ipdl @@ -29,13 +29,19 @@ namespace layers { /** - * If APZ is enabled then one PAPZ will be opened per PBrowser between the - * process where the PBrowser child actor lives and the main process (the - * PBrowser parent actor doesn't necessarily live in the main process, for - * example with nested browsers). This will typically be set up when the layers - * id is allocated for the PBrowser. + * PAPZ is a protocol for remoting a GeckoContentController. PAPZ lives on the + * PCompositorBridge protocol which either connects to the compositor thread + * in the main process, or to the compositor thread in the gpu processs. * - * Opened through PContent and runs on the main thread in both parent and child. + * PAPZParent lives in the compositor thread, while PAPZChild lives wherever the remoted + * GeckoContentController lives (generally the main thread of the main or content process). + * RemoteContentController implements PAPZParent, while APZChild implements PAPZChild. + * + * PAPZ is always used for ContentProcessController and only used for ChromeProcessController + * when there is a gpu process, otherwhise ChromeProcessController is used directly on the + * compositor thread. Only the methods that are used by the [Chrome,Content]ProcessController + * are implemented. If a new method is needed then PAPZ, APZChild, and RemoteContentController + * must be updated to handle it. */ sync protocol PAPZ { @@ -48,6 +54,7 @@ parent: async __delete__(); child: + async RequestContentRepaint(FrameMetrics frame); // The aCallTakeFocusForClickFromTap argument is used for eSingleTap types, diff --git a/gfx/layers/ipc/PAPZCTreeManager.ipdl b/gfx/layers/ipc/PAPZCTreeManager.ipdl index ea86424b39d3..7fca8ef71cb6 100644 --- a/gfx/layers/ipc/PAPZCTreeManager.ipdl +++ b/gfx/layers/ipc/PAPZCTreeManager.ipdl @@ -34,6 +34,15 @@ using class mozilla::ScrollWheelInput from "InputData.h"; namespace mozilla { namespace layers { +/** + * PAPZCTreeManager is a protocol for remoting an IAPZCTreeManager. PAPZCTreeManager + * lives on the PCompositorBridge protocol which either connects to the compositor + * thread in the main process, or to the compositor thread in the gpu processs. + * + * PAPZCTreeManagerParent lives in the compositor thread, while PAPZCTreeManagerChild + * lives in the main thread of the main or the content process. APZCTreeManagerParent + * and APZCTreeManagerChild implement this protocol. + */ sync protocol PAPZCTreeManager { manager PCompositorBridge; diff --git a/gfx/layers/ipc/RemoteContentController.h b/gfx/layers/ipc/RemoteContentController.h index 9a05aa6b8c2e..4824736a9c1b 100644 --- a/gfx/layers/ipc/RemoteContentController.h +++ b/gfx/layers/ipc/RemoteContentController.h @@ -20,11 +20,14 @@ class TabParent; namespace layers { /** - * RemoteContentController uses the PAPZ protocol to implement a - * GeckoContentController for a browser living in a remote process. - * Most of the member functions can be called on any thread, exceptions are - * annotated in comments. The PAPZ protocol runs on the main thread (so all the - * Recv* member functions do too). + * RemoteContentController implements PAPZChild and is used to access a + * GeckoContentController that lives in a different process. + * + * RemoteContentController lives on the compositor thread. All methods can + * be called off the compositor thread and will get dispatched to the right + * thread, with the exception of RequestContentRepaint and NotifyFlushComplete, + * which must be called on the repaint thread, which in this case is the compositor + * thread. */ class RemoteContentController : public GeckoContentController , public PAPZParent