Bug 1028383 - Make ITopLevelProtocol assert to enforce its assumptions that things happen on the main thread - r=bent

This commit is contained in:
Benoit Jacob 2014-07-04 14:04:13 -04:00
parent b610e8849f
commit 5192c5f558
2 changed files with 7 additions and 0 deletions

View File

@ -19,11 +19,14 @@ namespace ipc {
IToplevelProtocol::~IToplevelProtocol() IToplevelProtocol::~IToplevelProtocol()
{ {
MOZ_ASSERT(NS_IsMainThread());
mOpenActors.clear(); mOpenActors.clear();
} }
void IToplevelProtocol::AddOpenedActor(IToplevelProtocol* aActor) void IToplevelProtocol::AddOpenedActor(IToplevelProtocol* aActor)
{ {
MOZ_ASSERT(NS_IsMainThread());
#ifdef DEBUG #ifdef DEBUG
for (const IToplevelProtocol* actor = mOpenActors.getFirst(); for (const IToplevelProtocol* actor = mOpenActors.getFirst();
actor; actor;

View File

@ -21,6 +21,7 @@
#include "mozilla/ipc/Transport.h" #include "mozilla/ipc/Transport.h"
#include "mozilla/ipc/MessageLink.h" #include "mozilla/ipc/MessageLink.h"
#include "mozilla/LinkedList.h" #include "mozilla/LinkedList.h"
#include "MainThreadUtils.h"
#if defined(ANDROID) && defined(DEBUG) #if defined(ANDROID) && defined(DEBUG)
#include <android/log.h> #include <android/log.h>
@ -187,6 +188,7 @@ protected:
: mProtocolId(aProtoId) : mProtocolId(aProtoId)
, mTrans(nullptr) , mTrans(nullptr)
{ {
MOZ_ASSERT(NS_IsMainThread());
} }
~IToplevelProtocol(); ~IToplevelProtocol();
@ -212,10 +214,12 @@ public:
*/ */
IToplevelProtocol* GetFirstOpenedActors() IToplevelProtocol* GetFirstOpenedActors()
{ {
MOZ_ASSERT(NS_IsMainThread());
return mOpenActors.getFirst(); return mOpenActors.getFirst();
} }
const IToplevelProtocol* GetFirstOpenedActors() const const IToplevelProtocol* GetFirstOpenedActors() const
{ {
MOZ_ASSERT(NS_IsMainThread());
return mOpenActors.getFirst(); return mOpenActors.getFirst();
} }