Skip to content

Commit

Permalink
Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=b…
Browse files Browse the repository at this point in the history
…smedberg
  • Loading branch information
jcranmer committed Jul 19, 2013
1 parent e6f2b73 commit 18d7634
Show file tree
Hide file tree
Showing 78 changed files with 188 additions and 198 deletions.
4 changes: 2 additions & 2 deletions xpcom/base/MapsMemoryReporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class MapsReporter MOZ_FINAL : public nsIMemoryMultiReporter
public:
MapsReporter();

NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS

NS_IMETHOD GetName(nsACString &aName)
{
Expand Down Expand Up @@ -158,7 +158,7 @@ class MapsReporter MOZ_FINAL : public nsIMemoryMultiReporter
nsTHashtable<nsCStringHashKey> mMozillaLibraries;
};

NS_IMPL_THREADSAFE_ISUPPORTS1(MapsReporter, nsIMemoryMultiReporter)
NS_IMPL_ISUPPORTS1(MapsReporter, nsIMemoryMultiReporter)

MapsReporter::MapsReporter()
: mSearchedForLibxul(false)
Expand Down
2 changes: 1 addition & 1 deletion xpcom/base/nsConsoleMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "nsReadableUtils.h"
#include "jsapi.h"

NS_IMPL_THREADSAFE_ISUPPORTS1(nsConsoleMessage, nsIConsoleMessage)
NS_IMPL_ISUPPORTS1(nsConsoleMessage, nsIConsoleMessage)

nsConsoleMessage::nsConsoleMessage()
: mTimeStamp(0),
Expand Down
2 changes: 1 addition & 1 deletion xpcom/base/nsConsoleMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class nsConsoleMessage MOZ_FINAL : public nsIConsoleMessage {
nsConsoleMessage();
nsConsoleMessage(const PRUnichar *message);

NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSICONSOLEMESSAGE

private:
Expand Down
4 changes: 2 additions & 2 deletions xpcom/base/nsConsoleService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

using namespace mozilla;

NS_IMPL_THREADSAFE_ADDREF(nsConsoleService)
NS_IMPL_THREADSAFE_RELEASE(nsConsoleService)
NS_IMPL_ADDREF(nsConsoleService)
NS_IMPL_RELEASE(nsConsoleService)
NS_IMPL_CLASSINFO(nsConsoleService, NULL, nsIClassInfo::THREADSAFE | nsIClassInfo::SINGLETON, NS_CONSOLESERVICE_CID)
NS_IMPL_QUERY_INTERFACE1_CI(nsConsoleService, nsIConsoleService)
NS_IMPL_CI_INTERFACE_GETTER1(nsConsoleService, nsIConsoleService)
Expand Down
2 changes: 1 addition & 1 deletion xpcom/base/nsConsoleService.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class nsConsoleService MOZ_FINAL : public nsIConsoleService
nsConsoleService();
nsresult Init();

NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSICONSOLESERVICE

void SetIsDelivering() {
Expand Down
12 changes: 6 additions & 6 deletions xpcom/base/nsExceptionService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class nsProviderKey : public nsHashKey {
class nsExceptionManager MOZ_FINAL : public nsIExceptionManager
{
public:
NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIEXCEPTIONMANAGER

nsExceptionManager(nsExceptionService *svc);
Expand All @@ -67,7 +67,7 @@ int32_t nsExceptionManager::totalInstances = 0;
// one per thread.
// An exception if the destructor, which may be called on
// the thread shutting down xpcom
NS_IMPL_THREADSAFE_ISUPPORTS1(nsExceptionManager, nsIExceptionManager)
NS_IMPL_ISUPPORTS1(nsExceptionManager, nsIExceptionManager)

nsExceptionManager::nsExceptionManager(nsExceptionService *svc) :
mNextThread(nullptr),
Expand Down Expand Up @@ -122,10 +122,10 @@ nsExceptionManager *nsExceptionService::firstThread = nullptr;
int32_t nsExceptionService::totalInstances = 0;
#endif

NS_IMPL_THREADSAFE_ISUPPORTS3(nsExceptionService,
nsIExceptionService,
nsIExceptionManager,
nsIObserver)
NS_IMPL_ISUPPORTS3(nsExceptionService,
nsIExceptionService,
nsIExceptionManager,
nsIObserver)

nsExceptionService::nsExceptionService()
: mProviders(4, true) /* small, thread-safe hashtable */
Expand Down
2 changes: 1 addition & 1 deletion xpcom/base/nsExceptionService.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class nsExceptionManager;
class nsExceptionService MOZ_FINAL : public nsIExceptionService, public nsIObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIEXCEPTIONSERVICE
NS_DECL_NSIEXCEPTIONMANAGER
NS_DECL_NSIOBSERVER
Expand Down
10 changes: 5 additions & 5 deletions xpcom/base/nsIMemoryReporter.idl
Original file line number Diff line number Diff line change
Expand Up @@ -310,30 +310,30 @@ interface nsIMemoryReporterManager : nsISupports
#define NS_MEMORY_REPORTER_IMPLEMENT_HELPER(_classname, _path, _kind, _units, _amountFunction, _desc, _ts) \
class MemoryReporter_##_classname MOZ_FINAL : public nsIMemoryReporter { \
public: \
NS_DECL_ISUPPORTS \
NS_DECL##_ts##ISUPPORTS \
NS_IMETHOD GetProcess(nsACString &process) { process.Truncate(); return NS_OK; } \
NS_IMETHOD GetPath(nsACString &memoryPath) { memoryPath.AssignLiteral(_path); return NS_OK; } \
NS_IMETHOD GetKind(int *kind) { *kind = _kind; return NS_OK; } \
NS_IMETHOD GetUnits(int *units) { *units = _units; return NS_OK; } \
NS_IMETHOD GetAmount(int64_t *amount) { *amount = _amountFunction(); return NS_OK; } \
NS_IMETHOD GetDescription(nsACString &desc) { desc.AssignLiteral(_desc); return NS_OK; } \
}; \
NS_IMPL##_ts##ISUPPORTS1(MemoryReporter_##_classname, nsIMemoryReporter)
NS_IMPL_ISUPPORTS1(MemoryReporter_##_classname, nsIMemoryReporter)

// The only difference between this and NS_MEMORY_REPORTER_IMPLEMENT_HELPER
// is that the function used to implement GetAmount is fallible.
#define NS_FALLIBLE_MEMORY_REPORTER_IMPLEMENT_HELPER(_classname, _path, _kind, _units, _amountFunction, _desc, _ts) \
class MemoryReporter_##_classname MOZ_FINAL : public nsIMemoryReporter { \
public: \
NS_DECL_ISUPPORTS \
NS_DECL##_ts##ISUPPORTS \
NS_IMETHOD GetProcess(nsACString &process) { process.Truncate(); return NS_OK; } \
NS_IMETHOD GetPath(nsACString &memoryPath) { memoryPath.AssignLiteral(_path); return NS_OK; } \
NS_IMETHOD GetKind(int32_t *kind) { *kind = _kind; return NS_OK; } \
NS_IMETHOD GetUnits(int32_t *units) { *units = _units; return NS_OK; } \
NS_IMETHOD GetAmount(int64_t *amount) { return _amountFunction(amount); } \
NS_IMETHOD GetDescription(nsACString &desc) { desc.AssignLiteral(_desc); return NS_OK; }\
}; \
NS_IMPL##_ts##ISUPPORTS1(MemoryReporter_##_classname, nsIMemoryReporter)
NS_IMPL_ISUPPORTS1(MemoryReporter_##_classname, nsIMemoryReporter)

#define NS_MEMORY_REPORTER_IMPLEMENT(_c, _p, _k, _u, _a, _d) \
NS_MEMORY_REPORTER_IMPLEMENT_HELPER(_c, _p, _k, _u, _a, _d, _)
Expand Down Expand Up @@ -448,7 +448,7 @@ public:

virtual ~MemoryReporterBase() {}

NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS

NS_IMETHOD GetProcess(nsACString& aProcess)
{
Expand Down
6 changes: 3 additions & 3 deletions xpcom/base/nsInterfaceRequestorAgg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
class nsInterfaceRequestorAgg MOZ_FINAL : public nsIInterfaceRequestor
{
public:
NS_DECL_ISUPPORTS
// XXX This needs to support threadsafe refcounting until we fix bug 243591.
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIINTERFACEREQUESTOR

nsInterfaceRequestorAgg(nsIInterfaceRequestor *aFirst,
Expand All @@ -32,8 +33,7 @@ class nsInterfaceRequestorAgg MOZ_FINAL : public nsIInterfaceRequestor
nsCOMPtr<nsIEventTarget> mConsumerTarget;
};

// XXX This needs to support threadsafe refcounting until we fix bug 243591.
NS_IMPL_THREADSAFE_ISUPPORTS1(nsInterfaceRequestorAgg, nsIInterfaceRequestor)
NS_IMPL_ISUPPORTS1(nsInterfaceRequestorAgg, nsIInterfaceRequestor)

NS_IMETHODIMP
nsInterfaceRequestorAgg::GetInterface(const nsIID &aIID, void **aResult)
Expand Down
4 changes: 2 additions & 2 deletions xpcom/base/nsMemoryInfoDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class FdWatcher : public MessageLoopForIO::Watcher
virtual void OnFileCanReadWithoutBlocking(int aFd) = 0;
virtual void OnFileCanWriteWithoutBlocking(int aFd) {};

NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS

/**
* Initialize this object. This should be called right after the object is
Expand Down Expand Up @@ -258,7 +258,7 @@ class FdWatcher : public MessageLoopForIO::Watcher
}
};

NS_IMPL_THREADSAFE_ISUPPORTS1(FdWatcher, nsIObserver);
NS_IMPL_ISUPPORTS1(FdWatcher, nsIObserver);

class SignalPipeWatcher : public FdWatcher
{
Expand Down
4 changes: 2 additions & 2 deletions xpcom/base/nsMemoryReporterManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ NS_IMPL_ISUPPORTS1(DMDMultiReporter, nsIMemoryMultiReporter)
** nsMemoryReporterManager implementation
**/

NS_IMPL_THREADSAFE_ISUPPORTS1(nsMemoryReporterManager, nsIMemoryReporterManager)
NS_IMPL_ISUPPORTS1(nsMemoryReporterManager, nsIMemoryReporterManager)

NS_IMETHODIMP
nsMemoryReporterManager::Init()
Expand Down Expand Up @@ -1199,7 +1199,7 @@ nsMemoryReporterManager::MinimizeMemoryUsage(nsIRunnable* aCallback,
// Most memory reporters don't need thread safety, but some do. Make them all
// thread-safe just to be safe. Memory reporters are created and destroyed
// infrequently enough that the performance cost should be negligible.
NS_IMPL_THREADSAFE_ISUPPORTS1(MemoryReporterBase, nsIMemoryReporter)
NS_IMPL_ISUPPORTS1(MemoryReporterBase, nsIMemoryReporter)

nsresult
NS_RegisterMemoryReporter (nsIMemoryReporter *reporter)
Expand Down
2 changes: 1 addition & 1 deletion xpcom/base/nsMemoryReporterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using mozilla::Mutex;
class nsMemoryReporterManager : public nsIMemoryReporterManager
{
public:
NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIMEMORYREPORTERMANAGER

nsMemoryReporterManager();
Expand Down
2 changes: 1 addition & 1 deletion xpcom/base/nsUUIDGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

using namespace mozilla;

NS_IMPL_THREADSAFE_ISUPPORTS1(nsUUIDGenerator, nsIUUIDGenerator)
NS_IMPL_ISUPPORTS1(nsUUIDGenerator, nsIUUIDGenerator)

nsUUIDGenerator::nsUUIDGenerator()
: mLock("nsUUIDGenerator.mLock")
Expand Down
2 changes: 1 addition & 1 deletion xpcom/base/nsUUIDGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class nsUUIDGenerator MOZ_FINAL : public nsIUUIDGenerator {
public:
nsUUIDGenerator();

NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS

NS_DECL_NSIUUIDGENERATOR

Expand Down
2 changes: 1 addition & 1 deletion xpcom/components/ModuleUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class GenericModule MOZ_FINAL : public nsIModule
{
}

NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIMODULE

private:
Expand Down
12 changes: 6 additions & 6 deletions xpcom/components/nsComponentManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,12 +834,12 @@ nsComponentManagerImpl::~nsComponentManagerImpl()
PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, ("nsComponentManager: Destroyed."));
}

NS_IMPL_THREADSAFE_ISUPPORTS5(nsComponentManagerImpl,
nsIComponentManager,
nsIServiceManager,
nsIComponentRegistrar,
nsISupportsWeakReference,
nsIInterfaceRequestor)
NS_IMPL_ISUPPORTS5(nsComponentManagerImpl,
nsIComponentManager,
nsIServiceManager,
nsIComponentRegistrar,
nsISupportsWeakReference,
nsIInterfaceRequestor)


nsresult
Expand Down
2 changes: 1 addition & 1 deletion xpcom/components/nsComponentManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class nsComponentManagerImpl MOZ_FINAL
, public nsIInterfaceRequestor
{
public:
NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSICOMPONENTMANAGER
NS_DECL_NSICOMPONENTREGISTRAR
Expand Down
2 changes: 1 addition & 1 deletion xpcom/ds/nsAtomService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "nsAtomService.h"

NS_IMPL_THREADSAFE_ISUPPORTS1(nsAtomService, nsIAtomService)
NS_IMPL_ISUPPORTS1(nsAtomService, nsIAtomService)

nsAtomService::nsAtomService()
{
Expand Down
2 changes: 1 addition & 1 deletion xpcom/ds/nsAtomService.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class nsAtomService MOZ_FINAL : public nsIAtomService
{
public:
nsAtomService();
NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS

NS_DECL_NSIATOMSERVICE

Expand Down
4 changes: 2 additions & 2 deletions xpcom/ds/nsHashPropertyBag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ NS_NewHashPropertyBag(nsIWritablePropertyBag* *_retval)
* nsHashPropertyBag impl
*/

NS_IMPL_THREADSAFE_ADDREF(nsHashPropertyBag)
NS_IMPL_THREADSAFE_RELEASE(nsHashPropertyBag)
NS_IMPL_ADDREF(nsHashPropertyBag)
NS_IMPL_RELEASE(nsHashPropertyBag)
NS_INTERFACE_MAP_BEGIN(nsHashPropertyBag)
NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIPropertyBag, nsIWritablePropertyBag)
Expand Down
2 changes: 1 addition & 1 deletion xpcom/ds/nsHashPropertyBag.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class nsHashPropertyBag : public nsIWritablePropertyBag

nsresult Init();

NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS

NS_DECL_NSIPROPERTYBAG

Expand Down
2 changes: 1 addition & 1 deletion xpcom/ds/nsObserverService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ GetObserverServiceLog()
// nsObserverService Implementation


NS_IMPL_THREADSAFE_ISUPPORTS2(nsObserverService, nsIObserverService, nsObserverService)
NS_IMPL_ISUPPORTS2(nsObserverService, nsIObserverService, nsObserverService)

nsObserverService::nsObserverService() :
mShuttingDown(false)
Expand Down
2 changes: 1 addition & 1 deletion xpcom/ds/nsObserverService.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class nsObserverService MOZ_FINAL : public nsIObserverService {

nsObserverService();

NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIOBSERVERSERVICE

void Shutdown();
Expand Down
2 changes: 1 addition & 1 deletion xpcom/ds/nsPersistentProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ nsPersistentProperties::Create(nsISupports *aOuter, REFNSIID aIID, void **aResul
return rv;
}

NS_IMPL_THREADSAFE_ISUPPORTS2(nsPersistentProperties, nsIPersistentProperties, nsIProperties)
NS_IMPL_ISUPPORTS2(nsPersistentProperties, nsIPersistentProperties, nsIProperties)

NS_IMETHODIMP
nsPersistentProperties::Load(nsIInputStream *aIn)
Expand Down
2 changes: 1 addition & 1 deletion xpcom/ds/nsPersistentProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class nsPersistentProperties MOZ_FINAL : public nsIPersistentProperties
nsPersistentProperties();
nsresult Init();

NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIPROPERTIES
NS_DECL_NSIPERSISTENTPROPERTIES

Expand Down
2 changes: 1 addition & 1 deletion xpcom/ds/nsSupportsArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ nsSupportsArray::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
return it->QueryInterface(aIID, aResult);
}

NS_IMPL_THREADSAFE_ISUPPORTS3(nsSupportsArray, nsISupportsArray, nsICollection, nsISerializable)
NS_IMPL_ISUPPORTS3(nsSupportsArray, nsISupportsArray, nsICollection, nsISerializable)

NS_IMETHODIMP
nsSupportsArray::Read(nsIObjectInputStream *aStream)
Expand Down
2 changes: 1 addition & 1 deletion xpcom/ds/nsSupportsArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class nsSupportsArray MOZ_FINAL : public nsISupportsArray {
static nsresult
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);

NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS

NS_DECL_NSISERIALIZABLE

Expand Down
14 changes: 7 additions & 7 deletions xpcom/ds/nsSupportsPrimitives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ NS_IMETHODIMP nsSupportsStringImpl::SetData(const nsAString& aData)

/***************************************************************************/

NS_IMPL_THREADSAFE_ISUPPORTS2(nsSupportsPRBoolImpl, nsISupportsPRBool,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsPRBoolImpl, nsISupportsPRBool,
nsISupportsPrimitive)

nsSupportsPRBoolImpl::nsSupportsPRBoolImpl()
: mData(false)
Expand Down Expand Up @@ -683,8 +683,8 @@ NS_IMETHODIMP nsSupportsDoubleImpl::ToString(char **_retval)
/***************************************************************************/


NS_IMPL_THREADSAFE_ISUPPORTS2(nsSupportsVoidImpl, nsISupportsVoid,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsVoidImpl, nsISupportsVoid,
nsISupportsPrimitive)

nsSupportsVoidImpl::nsSupportsVoidImpl()
: mData(nullptr)
Expand Down Expand Up @@ -725,9 +725,9 @@ NS_IMETHODIMP nsSupportsVoidImpl::ToString(char **_retval)
/***************************************************************************/


NS_IMPL_THREADSAFE_ISUPPORTS2(nsSupportsInterfacePointerImpl,
nsISupportsInterfacePointer,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsInterfacePointerImpl,
nsISupportsInterfacePointer,
nsISupportsPrimitive)

nsSupportsInterfacePointerImpl::nsSupportsInterfacePointerImpl()
: mIID(nullptr)
Expand Down
Loading

0 comments on commit 18d7634

Please sign in to comment.