Bug 1129774. Part 2: Remove nsBaseWidget::mContext. r=jmathies
authorRobert O'Callahan <robert@ocallahan.org>
Thu, 05 Feb 2015 17:54:45 +1300
changeset 227806 684d707a559116ab6ccbeba130376eee099ca083
parent 227805 c3c91812f0acc8b8b33f816390a40e00e2ed7d9e
child 227807 84c124ae9f6f2265a847f359b38f873ac5d297fb
push id28240
push userryanvm@gmail.com
push dateFri, 06 Feb 2015 14:13:40 +0000
treeherderautoland@17ad80d79824 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmathies
bugs1129774
milestone38.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 1129774. Part 2: Remove nsBaseWidget::mContext. r=jmathies
widget/nsBaseWidget.cpp
widget/nsBaseWidget.h
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -113,17 +113,16 @@ nsAutoRollup::~nsAutoRollup()
 //
 // nsBaseWidget constructor
 //
 //-------------------------------------------------------------------------
 
 nsBaseWidget::nsBaseWidget()
 : mWidgetListener(nullptr)
 , mAttachedWidgetListener(nullptr)
-, mContext(nullptr)
 , mCompositorVsyncDispatcher(nullptr)
 , mCursor(eCursor_standard)
 , mUpdateCursor(true)
 , mBorderStyle(eBorderStyle_none)
 , mUseLayersAcceleration(false)
 , mForceLayersAcceleration(false)
 , mTemporarilyUseBasicLayerManager(false)
 , mUseAttachedEvents(false)
@@ -241,17 +240,16 @@ nsBaseWidget::~nsBaseWidget()
 
   DestroyCompositor();
 
 #ifdef NOISY_WIDGET_LEAKS
   gNumWidgets--;
   printf("WIDGETS- = %d\n", gNumWidgets);
 #endif
 
-  NS_IF_RELEASE(mContext);
   delete mOriginalBounds;
 
   // Can have base widgets that are things like tooltips which don't have CompositorVsyncDispatchers
   if (mCompositorVsyncDispatcher) {
     mCompositorVsyncDispatcher->Shutdown();
   }
 }
 
@@ -269,26 +267,16 @@ void nsBaseWidget::BaseCreate(nsIWidget 
   if (!gDisableNativeThemeCached) {
     Preferences::AddBoolVarCache(&gDisableNativeTheme,
                                  "mozilla.widget.disable-native-theme",
                                  gDisableNativeTheme);
     gDisableNativeThemeCached = true;
   }
 
   // keep a reference to the device context
-  if (aContext) {
-    mContext = aContext;
-    NS_ADDREF(mContext);
-  }
-  else {
-    mContext = new nsDeviceContext();
-    NS_ADDREF(mContext);
-    mContext->Init(nullptr);
-  }
-
   if (nullptr != aInitData) {
     mWindowType = aInitData->mWindowType;
     mBorderStyle = aInitData->mBorderStyle;
     mPopupLevel = aInitData->mPopupLevel;
     mPopupType = aInitData->mPopupHint;
     mRequireOffMainThreadCompositing = aInitData->mRequireOffMainThreadCompositing;
   }
 
@@ -361,24 +349,16 @@ nsBaseWidget::AttachViewToTopLevel(bool 
   NS_ASSERTION((mWindowType == eWindowType_toplevel ||
                 mWindowType == eWindowType_dialog ||
                 mWindowType == eWindowType_invisible ||
                 mWindowType == eWindowType_child),
                "Can't attach to window of that type");
 
   mUseAttachedEvents = aUseAttachedEvents;
 
-  if (aContext) {
-    if (mContext) {
-      NS_IF_RELEASE(mContext);
-    }
-    mContext = aContext;
-    NS_ADDREF(mContext);
-  }
-
   return NS_OK;
 }
 
 nsIWidgetListener* nsBaseWidget::GetAttachedWidgetListener()
  {
    return mAttachedWidgetListener;
  }
 
@@ -1129,19 +1109,16 @@ TemporaryRef<mozilla::gfx::DrawTarget> n
 
 //-------------------------------------------------------------------------
 //
 // Destroy the window
 //
 //-------------------------------------------------------------------------
 void nsBaseWidget::OnDestroy()
 {
-  // release references to device context and app shell
-  NS_IF_RELEASE(mContext);
-
   if (mTextEventDispatcher) {
     mTextEventDispatcher->OnDestroyWidget();
     // Don't release it until this widget actually released because after this
     // is called, TextEventDispatcher() may create it again.
   }
 }
 
 NS_METHOD nsBaseWidget::SetWindowClass(const nsAString& xulWinType)
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -427,17 +427,16 @@ protected:
    * It is safe to call it several times if platform implementations
    * require the compositor to be destroyed before ~nsBaseWidget is
    * reached (This is the case with gtk2 for instance).
    */
   void DestroyCompositor();
 
   nsIWidgetListener* mWidgetListener;
   nsIWidgetListener* mAttachedWidgetListener;
-  nsDeviceContext* mContext;
   nsRefPtr<LayerManager> mLayerManager;
   nsRefPtr<LayerManager> mBasicLayerManager;
   nsRefPtr<CompositorChild> mCompositorChild;
   nsRefPtr<CompositorParent> mCompositorParent;
   nsRefPtr<mozilla::CompositorVsyncDispatcher> mCompositorVsyncDispatcher;
   nsRefPtr<APZCTreeManager> mAPZC;
   nsRefPtr<WidgetShutdownObserver> mShutdownObserver;
   nsRefPtr<TextEventDispatcher> mTextEventDispatcher;