Bug 1168219 - Make nsIWidget::Configuration::mChild a smart pointer. r=vlad
authorMichael Layzell <michael@thelayzells.com>
Mon, 25 May 2015 14:45:00 -0400
changeset 245697 21d4e71220640f131adfe6fe6888f3055e6f5c48
parent 245696 e840013600aa92a7715c2b11c36132a0785a0ded
child 245698 ff31a31f9203b1e63ee6b735a59696b29a0e49d5
push id28814
push userkwierso@gmail.com
push dateTue, 26 May 2015 23:16:29 +0000
treeherdermozilla-central@ff2e07228041 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvlad
bugs1168219
milestone41.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 1168219 - Make nsIWidget::Configuration::mChild a smart pointer. r=vlad
widget/PuppetWidget.cpp
widget/android/nsWindow.cpp
widget/gtk/nsWindow.cpp
widget/nsIWidget.h
widget/windows/nsWindow.cpp
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -224,17 +224,17 @@ PuppetWidget::Resize(double aWidth,
   return NS_OK;
 }
 
 nsresult
 PuppetWidget::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
 {
   for (uint32_t i = 0; i < aConfigurations.Length(); ++i) {
     const Configuration& configuration = aConfigurations[i];
-    PuppetWidget* w = static_cast<PuppetWidget*>(configuration.mChild);
+    PuppetWidget* w = static_cast<PuppetWidget*>(configuration.mChild.get());
     NS_ASSERTION(w->GetParent() == this,
                  "Configured widget is not a child");
     w->SetWindowClipRegion(configuration.mClipRegion, true);
     nsIntRect bounds;
     w->GetBounds(bounds);
     if (bounds.Size() != configuration.mBounds.Size()) {
       w->Resize(configuration.mBounds.x, configuration.mBounds.y,
                 configuration.mBounds.width, configuration.mBounds.height,
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -275,17 +275,17 @@ nsWindow::Destroy(void)
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindow::ConfigureChildren(const nsTArray<nsIWidget::Configuration>& config)
 {
     for (uint32_t i = 0; i < config.Length(); ++i) {
-        nsWindow *childWin = (nsWindow*) config[i].mChild;
+        nsWindow *childWin = (nsWindow*) config[i].mChild.get();
         childWin->Resize(config[i].mBounds.x,
                          config[i].mBounds.y,
                          config[i].mBounds.width,
                          config[i].mBounds.height,
                          false);
     }
 
     return NS_OK;
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -4124,17 +4124,17 @@ nsWindow::ConfigureChildren(const nsTArr
     // size information from a source other than our owner. Don't let our parent
     // update this information.
     if (mWindowType == eWindowType_plugin_ipc_chrome) {
       return NS_OK;
     }
 
     for (uint32_t i = 0; i < aConfigurations.Length(); ++i) {
         const Configuration& configuration = aConfigurations[i];
-        nsWindow* w = static_cast<nsWindow*>(configuration.mChild);
+        nsWindow* w = static_cast<nsWindow*>(configuration.mChild.get());
         NS_ASSERTION(w->GetParent() == this,
                      "Configured widget is not a child");
         w->SetWindowClipRegion(configuration.mClipRegion, true);
         if (w->mBounds.Size() != configuration.mBounds.Size()) {
             w->Resize(configuration.mBounds.x, configuration.mBounds.y,
                       configuration.mBounds.width, configuration.mBounds.height,
                       true);
         } else if (w->mBounds.TopLeft() != configuration.mBounds.TopLeft()) {
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -1454,17 +1454,17 @@ class nsIWidget : public nsISupports {
      */
     virtual nsTransparencyMode GetTransparencyMode() = 0;
 
     /**
      * This represents a command to set the bounds and clip region of
      * a child widget.
      */
     struct Configuration {
-        nsIWidget* mChild;
+        nsCOMPtr<nsIWidget> mChild;
         uintptr_t mWindowID; // e10s specific, the unique plugin port id
         bool mVisible; // e10s specific, widget visibility
         nsIntRect mBounds;
         nsTArray<nsIntRect> mClipRegion;
     };
 
     /**
      * Sets the clip region of each mChild (which must actually be a child
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -6350,17 +6350,17 @@ nsWindow::ConfigureChildren(const nsTArr
     return NS_OK;
   }
 
   // XXXroc we could use BeginDeferWindowPos/DeferWindowPos/EndDeferWindowPos
   // here, if that helps in some situations. So far I haven't seen a
   // need.
   for (uint32_t i = 0; i < aConfigurations.Length(); ++i) {
     const Configuration& configuration = aConfigurations[i];
-    nsWindow* w = static_cast<nsWindow*>(configuration.mChild);
+    nsWindow* w = static_cast<nsWindow*>(configuration.mChild.get());
     NS_ASSERTION(w->GetParent() == this,
                  "Configured widget is not a child");
     nsresult rv = w->SetWindowClipRegion(configuration.mClipRegion, true);
     NS_ENSURE_SUCCESS(rv, rv);
     nsIntRect bounds;
     w->GetBounds(bounds);
     if (bounds.Size() != configuration.mBounds.Size()) {
       w->Resize(configuration.mBounds.x, configuration.mBounds.y,