Bug 884061 - Part 3x: Use NS_DECL_THREADSAFE_ISUPPORTS in widget/, r=jimm
authorJoshua Cranmer <Pidgeot18@gmail.com>
Thu, 18 Jul 2013 21:24:15 -0500
changeset 151907 c027e7494a86ac75fd8843a93648f21d6582f6c9
parent 151906 050a1e634338360286488fa5d5c1773ec40ee4b1
child 151908 b3533aba6520d7066c9063250e7350f5c7d6abfb
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs884061
milestone25.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 884061 - Part 3x: Use NS_DECL_THREADSAFE_ISUPPORTS in widget/, r=jimm
widget/android/AndroidBridge.cpp
widget/android/AndroidBridge.h
widget/gonk/GonkMemoryPressureMonitoring.cpp
widget/windows/AudioSession.cpp
widget/windows/LSPAnnotator.cpp
widget/windows/WinTaskbar.cpp
widget/windows/WinTaskbar.h
widget/windows/WinUtils.cpp
widget/windows/WinUtils.h
widget/xpwidgets/GfxInfoBase.cpp
widget/xpwidgets/GfxInfoBase.h
widget/xpwidgets/nsBaseAppShell.cpp
widget/xpwidgets/nsBaseAppShell.h
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -39,17 +39,17 @@
 #ifdef DEBUG
 #define ALOG_BRIDGE(args...) ALOG(args)
 #else
 #define ALOG_BRIDGE(args...) ((void)0)
 #endif
 
 using namespace mozilla;
 
-NS_IMPL_THREADSAFE_ISUPPORTS0(nsFilePickerCallback)
+NS_IMPL_ISUPPORTS0(nsFilePickerCallback)
 
 nsRefPtr<AndroidBridge> AndroidBridge::sBridge = nullptr;
 static unsigned sJavaEnvThreadIndex = 0;
 static void JavaThreadDetachFunc(void *arg);
 
 // This is a dummy class that can be used in the template for android::sp
 class AndroidRefable {
     void incStrong(void* thing) { }
--- a/widget/android/AndroidBridge.h
+++ b/widget/android/AndroidBridge.h
@@ -82,17 +82,17 @@ typedef struct AndroidSystemColors {
     nscolor colorForeground;
     nscolor colorBackground;
     nscolor panelColorForeground;
     nscolor panelColorBackground;
 } AndroidSystemColors;
 
 class nsFilePickerCallback : nsISupports {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     virtual void handleResult(nsAString& filePath) = 0;
     nsFilePickerCallback() {}
 protected:
     virtual ~nsFilePickerCallback() {}
 };
 
 class DelayedTask {
 public:
--- a/widget/gonk/GonkMemoryPressureMonitoring.cpp
+++ b/widget/gonk/GonkMemoryPressureMonitoring.cpp
@@ -60,17 +60,17 @@ class MemoryPressureWatcher
 {
 public:
   MemoryPressureWatcher()
     : mMonitor("MemoryPressureWatcher")
     , mShuttingDown(false)
   {
   }
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   nsresult Init()
   {
     nsCOMPtr<nsIObserverService> os = services::GetObserverService();
     NS_ENSURE_STATE(os);
 
     // The observer service holds us alive.
     os->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, /* holdsWeak */ false);
@@ -235,17 +235,17 @@ private:
   Monitor mMonitor;
   uint32_t mPollMS;
   bool mShuttingDown;
 
   ScopedClose mShutdownPipeRead;
   ScopedClose mShutdownPipeWrite;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(MemoryPressureWatcher, nsIRunnable, nsIObserver);
+NS_IMPL_ISUPPORTS2(MemoryPressureWatcher, nsIRunnable, nsIObserver);
 
 } // anonymous namespace
 
 namespace mozilla {
 
 void
 InitGonkMemoryPressureMonitoring()
 {
--- a/widget/windows/AudioSession.cpp
+++ b/widget/windows/AudioSession.cpp
@@ -82,17 +82,17 @@ public:
   };
 protected:
   nsRefPtr<IAudioSessionControl> mAudioSessionControl;
   nsString mDisplayName;
   nsString mIconPath;
   nsID mSessionGroupingParameter;
   SessionState mState;
 
-  nsAutoRefCnt mRefCnt;
+  ThreadSafeAutoRefCnt mRefCnt;
   NS_DECL_OWNINGTHREAD
 
   static AudioSession* sService;
 };
 
 nsresult
 StartAudioSession()
 {
@@ -146,18 +146,18 @@ AudioSession::GetSingleton()
   }
 
   // We don't refcount AudioSession on the Gecko side, we hold one single ref
   // as long as the appshell is running.
   return AudioSession::sService;
 }
 
 // It appears Windows will use us on a background thread ...
-NS_IMPL_THREADSAFE_ADDREF(AudioSession)
-NS_IMPL_THREADSAFE_RELEASE(AudioSession)
+NS_IMPL_ADDREF(AudioSession)
+NS_IMPL_RELEASE(AudioSession)
 
 STDMETHODIMP
 AudioSession::QueryInterface(REFIID iid, void **ppv)
 {
   const IID IID_IAudioSessionEvents = __uuidof(IAudioSessionEvents);
   if ((IID_IUnknown == iid) ||
       (IID_IAudioSessionEvents == iid)) {
     *ppv = static_cast<IAudioSessionEvents*>(this);
--- a/widget/windows/LSPAnnotator.cpp
+++ b/widget/windows/LSPAnnotator.cpp
@@ -19,25 +19,25 @@
 #include <ws2spi.h>
 
 namespace mozilla {
 namespace crashreporter {
 
 class LSPAnnotationGatherer : public nsRunnable
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   void Annotate();
   nsCString mString;
   nsCOMPtr<nsIThread> mThread;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(LSPAnnotationGatherer, nsIRunnable)
+NS_IMPL_ISUPPORTS1(LSPAnnotationGatherer, nsIRunnable)
 
 void
 LSPAnnotationGatherer::Annotate()
 {
   nsCOMPtr<nsICrashReporter> cr =
     do_GetService("@mozilla.org/toolkit/crash-reporter;1");
   bool enabled;
   if (cr && NS_SUCCEEDED(cr->GetEnabled(&enabled)) && enabled) {
--- a/widget/windows/WinTaskbar.cpp
+++ b/widget/windows/WinTaskbar.cpp
@@ -196,17 +196,17 @@ NS_IMPL_ISUPPORTS1(DefaultController, ns
 }
 
 namespace mozilla {
 namespace widget {
 
 ///////////////////////////////////////////////////////////////////////////////
 // nsIWinTaskbar
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(WinTaskbar, nsIWinTaskbar)
+NS_IMPL_ISUPPORTS1(WinTaskbar, nsIWinTaskbar)
 
 bool
 WinTaskbar::Initialize() {
   if (mTaskbar)
     return true;
 
   ::CoInitialize(NULL);
   HRESULT hr = ::CoCreateInstance(CLSID_TaskbarList,
--- a/widget/windows/WinTaskbar.h
+++ b/widget/windows/WinTaskbar.h
@@ -17,17 +17,17 @@ namespace mozilla {
 namespace widget {
 
 class WinTaskbar MOZ_FINAL : public nsIWinTaskbar
 {
 public: 
   WinTaskbar();
   ~WinTaskbar();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIWINTASKBAR
 
   // Registers the global app user model id for the instance.
   // See comments in WinTaskbar.cpp for more information.
   static bool RegisterAppUserModelID();
   static bool GetAppUserModelID(nsAString & aDefaultGroupId);
 
 private:
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -35,19 +35,19 @@
 
 namespace mozilla {
 namespace widget {
 
   NS_IMPL_ISUPPORTS1(myDownloadObserver, nsIDownloadObserver)
 #ifdef MOZ_PLACES
   NS_IMPL_ISUPPORTS1(AsyncFaviconDataReady, nsIFaviconDataCallback)
 #endif
-  NS_IMPL_THREADSAFE_ISUPPORTS1(AsyncEncodeAndWriteIcon, nsIRunnable)
-  NS_IMPL_THREADSAFE_ISUPPORTS1(AsyncDeleteIconFromDisk, nsIRunnable)
-  NS_IMPL_THREADSAFE_ISUPPORTS1(AsyncDeleteAllFaviconsFromDisk, nsIRunnable)
+  NS_IMPL_ISUPPORTS1(AsyncEncodeAndWriteIcon, nsIRunnable)
+  NS_IMPL_ISUPPORTS1(AsyncDeleteIconFromDisk, nsIRunnable)
+  NS_IMPL_ISUPPORTS1(AsyncDeleteAllFaviconsFromDisk, nsIRunnable)
 
 
   const char FaviconHelper::kJumpListCacheDir[] = "jumpListCache";
   const char FaviconHelper::kShortcutCacheDir[] = "shortcutCache";
 
 // apis available on vista and up.
 WinUtils::SHCreateItemFromParsingNamePtr WinUtils::sCreateItemFromParsingName = NULL;
 WinUtils::SHGetKnownFolderPathPtr WinUtils::sGetKnownFolderPath = NULL;
--- a/widget/windows/WinUtils.h
+++ b/widget/windows/WinUtils.h
@@ -291,17 +291,17 @@ private:
 
 /**
   * Asynchronously tries add the list to the build
   */
 class AsyncEncodeAndWriteIcon : public nsIRunnable
 {
 public:
   const bool mURLShortcut;
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   // Warning: AsyncEncodeAndWriteIcon assumes ownership of the aData buffer passed in
   AsyncEncodeAndWriteIcon(const nsAString &aIconPath,
                           uint8_t *aData, uint32_t aDataLen, uint32_t aStride,
                           uint32_t aWidth, uint32_t aHeight,
                           const bool aURLShortcut);
   virtual ~AsyncEncodeAndWriteIcon();
@@ -315,30 +315,30 @@ private:
   uint32_t mWidth;
   uint32_t mHeight;
 };
 
 
 class AsyncDeleteIconFromDisk : public nsIRunnable
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   AsyncDeleteIconFromDisk(const nsAString &aIconPath);
   virtual ~AsyncDeleteIconFromDisk();
 
 private:
   nsAutoString mIconPath;
 };
 
 class AsyncDeleteAllFaviconsFromDisk : public nsIRunnable
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   AsyncDeleteAllFaviconsFromDisk();
   virtual ~AsyncDeleteAllFaviconsFromDisk();
 };
 
 class FaviconHelper
 {
--- a/widget/xpwidgets/GfxInfoBase.cpp
+++ b/widget/xpwidgets/GfxInfoBase.cpp
@@ -82,17 +82,17 @@ void InitGfxDriverInfoShutdownObserver()
 
   ShutdownObserver *obs = new ShutdownObserver();
   observerService->AddObserver(obs, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
 }
 
 using namespace mozilla::widget;
 using namespace mozilla;
 
-NS_IMPL_THREADSAFE_ISUPPORTS3(GfxInfoBase, nsIGfxInfo, nsIObserver, nsISupportsWeakReference)
+NS_IMPL_ISUPPORTS3(GfxInfoBase, nsIGfxInfo, nsIObserver, nsISupportsWeakReference)
 
 #define BLACKLIST_PREF_BRANCH "gfx.blacklist."
 #define SUGGESTED_VERSION_PREF BLACKLIST_PREF_BRANCH "suggested-driver-version"
 #define BLACKLIST_ENTRY_TAG_NAME "gfxBlacklistEntry"
 
 static const char*
 GetPrefNameForFeature(int32_t aFeature)
 {
--- a/widget/xpwidgets/GfxInfoBase.h
+++ b/widget/xpwidgets/GfxInfoBase.h
@@ -28,17 +28,17 @@ class GfxInfoBase : public nsIGfxInfo,
 #ifdef DEBUG
                   , public nsIGfxInfoDebug
 #endif
 {
 public:
   GfxInfoBase();
   virtual ~GfxInfoBase();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIOBSERVER
 
   // We only declare a subset of the nsIGfxInfo interface. It's up to derived
   // classes to implement the rest of the interface.  
   // Derived classes need to use
   // using GfxInfoBase::GetFeatureStatus;
   // using GfxInfoBase::GetFeatureSuggestedDriverVersion;
   // using GfxInfoBase::GetWebGLParameter;
--- a/widget/xpwidgets/nsBaseAppShell.cpp
+++ b/widget/xpwidgets/nsBaseAppShell.cpp
@@ -11,18 +11,17 @@
 #include "nsServiceManagerUtils.h"
 #include "mozilla/Services.h"
 
 // When processing the next thread event, the appshell may process native
 // events (if not in performance mode), which can result in suppressing the
 // next thread event for at most this many ticks:
 #define THREAD_EVENT_STARVATION_LIMIT PR_MillisecondsToInterval(20)
 
-NS_IMPL_THREADSAFE_ISUPPORTS3(nsBaseAppShell, nsIAppShell, nsIThreadObserver,
-                              nsIObserver)
+NS_IMPL_ISUPPORTS3(nsBaseAppShell, nsIAppShell, nsIThreadObserver, nsIObserver)
 
 nsBaseAppShell::nsBaseAppShell()
   : mSuspendNativeCount(0)
   , mEventloopNestingLevel(0)
   , mBlockedWait(nullptr)
   , mFavorPerf(0)
   , mNativeEventPending(0)
   , mStarvationDelay(0)
--- a/widget/xpwidgets/nsBaseAppShell.h
+++ b/widget/xpwidgets/nsBaseAppShell.h
@@ -17,17 +17,17 @@
 /**
  * A singleton that manages the UI thread's event queue.  Subclass this class
  * to enable platform-specific event queue support.
  */
 class nsBaseAppShell : public nsIAppShell, public nsIThreadObserver,
                        public nsIObserver
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIAPPSHELL
   NS_DECL_NSITHREADOBSERVER
   NS_DECL_NSIOBSERVER
 
   nsBaseAppShell();
 
 protected:
   virtual ~nsBaseAppShell();