Bug 1095754 - Now that the compositor handles plugin geometry updates, remove various main thread apis from PluginWidgetProxy. r=aklotz
authorJim Mathies <jmathies@mozilla.com>
Thu, 29 Jan 2015 13:41:55 -0600
changeset 244075 49ad0d06ab60e83d292d62fcc433c4e46bf82359
parent 244074 905d21993e31159406afa7aecfeb118e140a59b1
child 244076 f1bac083d4ba88de34a314aff54c77ac95794e50
push id7677
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 18:11:24 +0000
treeherdermozilla-aurora@f531d838c055 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaklotz
bugs1095754
milestone38.0a1
Bug 1095754 - Now that the compositor handles plugin geometry updates, remove various main thread apis from PluginWidgetProxy. r=aklotz
widget/PluginWidgetProxy.cpp
widget/PluginWidgetProxy.h
--- a/widget/PluginWidgetProxy.cpp
+++ b/widget/PluginWidgetProxy.cpp
@@ -61,18 +61,16 @@ PluginWidgetProxy::Create(nsIWidget*    
   }
 
   BaseCreate(aParent, aRect, aContext, aInitData);
 
   mBounds = aRect;
   mEnabled = true;
   mVisible = true;
 
-  mActor->SendResize(mBounds);
-
   return NS_OK;
 }
 
 NS_IMETHODIMP
 PluginWidgetProxy::SetParent(nsIWidget* aNewParent)
 {
   mParent = aNewParent;
 
@@ -94,41 +92,31 @@ PluginWidgetProxy::GetParent(void)
 }
 
 NS_IMETHODIMP
 PluginWidgetProxy::Destroy()
 {
   PWLOG("PluginWidgetProxy::Destroy()\n");
 
   if (mActor) {
-    mActor->SendShow(false);
     mActor->SendDestroy();
     mActor->mWidget = nullptr;
     mActor->Send__delete__(mActor);
     mActor = nullptr;
   }
 
   return PuppetWidget::Destroy();
 }
 
-NS_IMETHODIMP
-PluginWidgetProxy::Show(bool aState)
+void
+PluginWidgetProxy::GetWindowClipRegion(nsTArray<nsIntRect>* aRects)
 {
-  ENSURE_CHANNEL;
-  mActor->SendShow(aState);
-  mVisible = aState;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-PluginWidgetProxy::Invalidate(const nsIntRect& aRect)
-{
-  ENSURE_CHANNEL;
-  mActor->SendInvalidate(aRect);
-  return NS_OK;
+  if (mClipRects && mClipRectCount) {
+    aRects->AppendElements(mClipRects.get(), mClipRectCount);
+  }
 }
 
 void*
 PluginWidgetProxy::GetNativeData(uint32_t aDataType)
 {
   if (!mActor) {
     return nullptr;
   }
@@ -143,65 +131,18 @@ PluginWidgetProxy::GetNativeData(uint32_
   }
   uintptr_t value = 0;
   mActor->SendGetNativePluginPort(&value);
   PWLOG("PluginWidgetProxy::GetNativeData %p\n", (void*)value);
   return (void*)value;
 }
 
 NS_IMETHODIMP
-PluginWidgetProxy::Resize(double aWidth, double aHeight, bool aRepaint)
-{
-  ENSURE_CHANNEL;
-  PWLOG("PluginWidgetProxy::Resize(%0.2f, %0.2f, %d)\n", aWidth, aHeight, aRepaint);
-  nsIntRect oldBounds = mBounds;
-  mBounds.SizeTo(nsIntSize(NSToIntRound(aWidth), NSToIntRound(aHeight)));
-  mActor->SendResize(mBounds);
-  if (!oldBounds.IsEqualEdges(mBounds) && mAttachedWidgetListener) {
-    mAttachedWidgetListener->WindowResized(this, mBounds.width, mBounds.height);
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-PluginWidgetProxy::Resize(double aX, double aY, double aWidth,
-                          double aHeight, bool aRepaint)
-{
-  nsresult rv = Move(aX, aY);
-  if (NS_FAILED(rv)) {
-    return rv;
-  }
-  return Resize(aWidth, aHeight, aRepaint);
-}
-
-NS_IMETHODIMP
-PluginWidgetProxy::Move(double aX, double aY)
-{
-  ENSURE_CHANNEL;
-  PWLOG("PluginWidgetProxy::Move(%0.2f, %0.2f)\n", aX, aY);
-  mActor->SendMove(aX, aY);
-  if (mAttachedWidgetListener) {
-    mAttachedWidgetListener->WindowMoved(this, aX, aY);
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 PluginWidgetProxy::SetFocus(bool aRaise)
 {
   ENSURE_CHANNEL;
   PWLOG("PluginWidgetProxy::SetFocus(%d)\n", aRaise);
   mActor->SendSetFocus(aRaise);
   return NS_OK;
 }
 
-nsresult
-PluginWidgetProxy::SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
-                                       bool aIntersectWithExisting)
-{
-  ENSURE_CHANNEL;
-  mActor->SendSetWindowClipRegion(aRects, aIntersectWithExisting);
-  nsBaseWidget::SetWindowClipRegion(aRects, aIntersectWithExisting);
-  return NS_OK;
-}
-
 }  // namespace widget
 }  // namespace mozilla
--- a/widget/PluginWidgetProxy.h
+++ b/widget/PluginWidgetProxy.h
@@ -33,33 +33,24 @@ protected:
 public:
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIWidget
   NS_IMETHOD Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
                     const nsIntRect& aRect, nsDeviceContext* aContext,
                     nsWidgetInitData* aInitData = nullptr) MOZ_OVERRIDE;
   NS_IMETHOD Destroy() MOZ_OVERRIDE;
-  NS_IMETHOD Show(bool aState) MOZ_OVERRIDE;
-  NS_IMETHOD Invalidate(const nsIntRect& aRect) MOZ_OVERRIDE;
-  NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint) MOZ_OVERRIDE;
-  NS_IMETHOD Resize(double aX, double aY, double aWidth,
-                    double aHeight, bool aRepaint)  MOZ_OVERRIDE;
-  NS_IMETHOD Move(double aX, double aY) MOZ_OVERRIDE;
   NS_IMETHOD SetFocus(bool aRaise = false) MOZ_OVERRIDE;
   NS_IMETHOD SetParent(nsIWidget* aNewParent) MOZ_OVERRIDE;
 
   virtual nsIWidget* GetParent(void) MOZ_OVERRIDE;
   virtual void* GetNativeData(uint32_t aDataType) MOZ_OVERRIDE;
-  virtual nsresult SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
-                                       bool aIntersectWithExisting) MOZ_OVERRIDE;
-
-  // nsBaseWidget
   virtual nsTransparencyMode GetTransparencyMode() MOZ_OVERRIDE
   { return eTransparencyOpaque; }
+  virtual void GetWindowClipRegion(nsTArray<nsIntRect>* aRects) MOZ_OVERRIDE;
 
 public:
   /**
    * When tabs are closed PPluginWidget can terminate before plugin code is
    * finished tearing us down. When this happens plugin calls over mActor
    * fail triggering an abort in the content process. To protect against this
    * the connection tells us when it is torn down here so we can avoid making
    * calls while content finishes tearing us down.