Bug 780920, part 2: Let clients query a widget's 'real' compositor, when the widget doesn't draw directly to its OS window. r=roc
authorChris Jones <jones.chris.g@gmail.com>
Thu, 04 Oct 2012 00:05:24 -0700
changeset 115516 abefcbf2f2ee3b3feefe42fcae7e8b142255e057
parent 115515 53bf054fe0f1e33215347d468ccd9777e0c85803
child 115517 c18ffc64e3d0e43d36c12da6432e43935e4946b7
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs780920
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 780920, part 2: Let clients query a widget's 'real' compositor, when the widget doesn't draw directly to its OS window. r=roc
widget/nsIWidget.h
widget/xpwidgets/nsBaseWidget.cpp
widget/xpwidgets/nsBaseWidget.h
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -37,16 +37,17 @@ class   ViewWrapper;
 class   nsIWidgetListener;
 class   nsIntRegion;
 
 namespace mozilla {
 namespace dom {
 class TabChild;
 }
 namespace layers {
+class CompositorChild;
 class LayerManager;
 class PLayersChild;
 }
 }
 
 /**
  * Callback function that processes events.
  *
@@ -84,18 +85,18 @@ typedef nsEventStatus (* EVENT_CALLBACK)
 #ifdef XP_WIN
 #define NS_NATIVE_TSF_THREAD_MGR       100
 #define NS_NATIVE_TSF_CATEGORY_MGR     101
 #define NS_NATIVE_TSF_DISPLAY_ATTR_MGR 102
 #define NS_NATIVE_ICOREWINDOW          103 // winrt specific
 #endif
 
 #define NS_IWIDGET_IID \
-  { 0xb8f43b25, 0x9036, 0x44e7, \
-    { 0xaa, 0xe2, 0x33, 0x76, 0x6c, 0x35, 0x91, 0xfc } }
+  { 0x4e05b167, 0x475b, 0x422b, \
+    { 0x88, 0xc0, 0xa5, 0xb1, 0x61, 0xcf, 0x87, 0x79 } }
 
 /*
  * Window shadow styles
  * Also used for the -moz-window-shadow CSS property
  */
 
 #define NS_STYLE_WINDOW_SHADOW_NONE             0
 #define NS_STYLE_WINDOW_SHADOW_DEFAULT          1
@@ -376,16 +377,17 @@ struct SizeConstraints {
  * The base class for all the widgets. It provides the interface for
  * all basic and necessary functionality.
  */
 class nsIWidget : public nsISupports {
   protected:
     typedef mozilla::dom::TabChild TabChild;
 
   public:
+    typedef mozilla::layers::CompositorChild CompositorChild;
     typedef mozilla::layers::LayerManager LayerManager;
     typedef mozilla::layers::LayersBackend LayersBackend;
     typedef mozilla::layers::PLayersChild PLayersChild;
     typedef mozilla::widget::IMEState IMEState;
     typedef mozilla::widget::InputContext InputContext;
     typedef mozilla::widget::InputContextAction InputContextAction;
     typedef mozilla::widget::SizeConstraints SizeConstraints;
 
@@ -1628,16 +1630,23 @@ class nsIWidget : public nsISupports {
     virtual const SizeConstraints& GetSizeConstraints() const = 0;
 
     /**
      * If this is owned by a TabChild, return that.  Otherwise return
      * null.
      */
     virtual TabChild* GetOwningTabChild() { return nullptr; }
 
+    /**
+     * If this isn't directly compositing to its window surface,
+     * return the compositor which is doing that on our behalf.
+     */
+    virtual CompositorChild* GetRemoteRenderer()
+    { return nullptr; }
+
 protected:
 
     // keep the list of children.  We also keep track of our siblings.
     // The ownership model is as follows: parent holds a strong ref to
     // the first element of the list, and each element holds a strong
     // ref to the next element in the list.  The prevsibling and
     // lastchild pointers are weak, which is fine as long as they are
     // maintained properly.
--- a/widget/xpwidgets/nsBaseWidget.cpp
+++ b/widget/xpwidgets/nsBaseWidget.cpp
@@ -917,16 +917,21 @@ LayerManager* nsBaseWidget::GetLayerMana
   return usedLayerManager;
 }
 
 BasicLayerManager* nsBaseWidget::CreateBasicLayerManager()
 {
       return new BasicShadowLayerManager(this);
 }
 
+CompositorChild* nsBaseWidget::GetRemoteRenderer()
+{
+  return mCompositorChild;
+}
+
 //-------------------------------------------------------------------------
 //
 // Return the used device context
 //
 //-------------------------------------------------------------------------
 nsDeviceContext* nsBaseWidget::GetDeviceContext() 
 {
   if (!mContextInitialized) {
--- a/widget/xpwidgets/nsBaseWidget.h
+++ b/widget/xpwidgets/nsBaseWidget.h
@@ -310,16 +310,18 @@ protected:
   void ConstrainSize(int32_t* aWidth, int32_t* aHeight) const
   {
     *aWidth = NS_MAX(mSizeConstraints.mMinSize.width,
                      NS_MIN(mSizeConstraints.mMaxSize.width, *aWidth));
     *aHeight = NS_MAX(mSizeConstraints.mMinSize.height,
                       NS_MIN(mSizeConstraints.mMaxSize.height, *aHeight));
   }
 
+  virtual CompositorChild* GetRemoteRenderer() MOZ_OVERRIDE;
+
 protected:
   /**
    * Starts the OMTC compositor destruction sequence.
    *
    * When this function returns, the compositor should not be 
    * able to access the opengl context anymore.
    * It is safe to call it several times if platform implementations
    * require the compositor to be destroyed before ~nsBaseWidget is