зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1253094, part 3 - Stop using DebugOnly for class/struct members in ipc/. r=billm
MozReview-Commit-ID: L16CD7xtn3V
This commit is contained in:
Родитель
2357eb85f9
Коммит
3d09b32ad7
|
@ -318,7 +318,9 @@ class ChildImpl final : public BackgroundChildImpl
|
|||
struct ThreadLocalInfo
|
||||
{
|
||||
explicit ThreadLocalInfo(nsIIPCBackgroundChildCreateCallback* aCallback)
|
||||
#ifdef DEBUG
|
||||
: mClosed(false)
|
||||
#endif
|
||||
{
|
||||
mCallbacks.AppendElement(aCallback);
|
||||
}
|
||||
|
@ -326,7 +328,9 @@ class ChildImpl final : public BackgroundChildImpl
|
|||
RefPtr<ChildImpl> mActor;
|
||||
nsTArray<nsCOMPtr<nsIIPCBackgroundChildCreateCallback>> mCallbacks;
|
||||
nsAutoPtr<BackgroundChildImpl::ThreadLocal> mConsumerThreadLocal;
|
||||
DebugOnly<bool> mClosed;
|
||||
#ifdef DEBUG
|
||||
bool mClosed;
|
||||
#endif
|
||||
};
|
||||
|
||||
// This is only modified on the main thread. It is a FIFO queue for actors
|
||||
|
@ -338,12 +342,16 @@ class ChildImpl final : public BackgroundChildImpl
|
|||
static bool sShutdownHasStarted;
|
||||
|
||||
#ifdef RELEASE_BUILD
|
||||
DebugOnly<nsIThread*> mBoundThread;
|
||||
#ifdef DEBUG
|
||||
nsIThread* mBoundThread;
|
||||
#endif
|
||||
#else
|
||||
nsIThread* mBoundThread;
|
||||
#endif
|
||||
|
||||
DebugOnly<bool> mActorDestroyed;
|
||||
#ifdef DEBUG
|
||||
bool mActorDestroyed;
|
||||
#endif
|
||||
|
||||
public:
|
||||
static bool
|
||||
|
@ -375,7 +383,9 @@ public:
|
|||
|
||||
ChildImpl()
|
||||
: mBoundThread(nullptr)
|
||||
#ifdef DEBUG
|
||||
, mActorDestroyed(false)
|
||||
#endif
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
}
|
||||
|
@ -1612,6 +1622,7 @@ ChildImpl::Shutdown()
|
|||
|
||||
sShutdownHasStarted = true;
|
||||
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(sThreadLocalIndex != kBadThreadLocalIndex);
|
||||
|
||||
auto threadLocalInfo =
|
||||
|
@ -1621,6 +1632,7 @@ ChildImpl::Shutdown()
|
|||
MOZ_ASSERT(!threadLocalInfo->mClosed);
|
||||
threadLocalInfo->mClosed = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
DebugOnly<PRStatus> status = PR_SetThreadPrivate(sThreadLocalIndex, nullptr);
|
||||
MOZ_ASSERT(status == PR_SUCCESS);
|
||||
|
@ -1747,8 +1759,10 @@ ChildImpl::CloseForCurrentThread()
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(!threadLocalInfo->mClosed);
|
||||
threadLocalInfo->mClosed = true;
|
||||
#endif
|
||||
|
||||
if (threadLocalInfo->mActor) {
|
||||
threadLocalInfo->mActor->FlushPendingInterruptQueue();
|
||||
|
@ -2092,8 +2106,10 @@ ChildImpl::ActorDestroy(ActorDestroyReason aWhy)
|
|||
{
|
||||
AssertIsOnBoundThread();
|
||||
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(!mActorDestroyed);
|
||||
mActorDestroyed = true;
|
||||
#endif
|
||||
|
||||
BackgroundChildImpl::ActorDestroy(aWhy);
|
||||
}
|
||||
|
|
|
@ -29,13 +29,17 @@
|
|||
using mozilla::ipc::FileDescriptor;
|
||||
|
||||
FileDescriptor::FileDescriptor()
|
||||
: mHandle(INVALID_HANDLE), mHandleCreatedByOtherProcess(false),
|
||||
mHandleCreatedByOtherProcessWasUsed(false)
|
||||
: mHandle(INVALID_HANDLE), mHandleCreatedByOtherProcess(false)
|
||||
#ifdef DEBUG
|
||||
, mHandleCreatedByOtherProcessWasUsed(false)
|
||||
#endif
|
||||
{ }
|
||||
|
||||
FileDescriptor::FileDescriptor(PlatformHandleType aHandle)
|
||||
: mHandle(INVALID_HANDLE), mHandleCreatedByOtherProcess(false),
|
||||
mHandleCreatedByOtherProcessWasUsed(false)
|
||||
: mHandle(INVALID_HANDLE), mHandleCreatedByOtherProcess(false)
|
||||
#ifdef DEBUG
|
||||
, mHandleCreatedByOtherProcessWasUsed(false)
|
||||
#endif
|
||||
{
|
||||
DuplicateInCurrentProcess(aHandle);
|
||||
}
|
||||
|
|
|
@ -52,8 +52,10 @@ public:
|
|||
FileDescriptor();
|
||||
|
||||
FileDescriptor(const FileDescriptor& aOther)
|
||||
: mHandleCreatedByOtherProcess(false),
|
||||
mHandleCreatedByOtherProcessWasUsed(false)
|
||||
: mHandleCreatedByOtherProcess(false)
|
||||
#ifdef DEBUG
|
||||
, mHandleCreatedByOtherProcessWasUsed(false)
|
||||
#endif
|
||||
{
|
||||
// Don't use operator= here because that will call
|
||||
// CloseCurrentProcessHandle() on this (uninitialized) object.
|
||||
|
@ -69,7 +71,9 @@ public:
|
|||
: mHandle(aPickle.fd)
|
||||
#endif
|
||||
, mHandleCreatedByOtherProcess(true)
|
||||
#ifdef DEBUG
|
||||
, mHandleCreatedByOtherProcessWasUsed(false)
|
||||
#endif
|
||||
{ }
|
||||
|
||||
~FileDescriptor()
|
||||
|
@ -102,9 +106,11 @@ public:
|
|||
PlatformHandleType
|
||||
PlatformHandle() const
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (mHandleCreatedByOtherProcess) {
|
||||
mHandleCreatedByOtherProcessWasUsed = true;
|
||||
}
|
||||
#endif
|
||||
return mHandle;
|
||||
}
|
||||
|
||||
|
@ -120,13 +126,17 @@ private:
|
|||
{
|
||||
if (aOther.mHandleCreatedByOtherProcess) {
|
||||
mHandleCreatedByOtherProcess = true;
|
||||
#ifdef DEBUG
|
||||
mHandleCreatedByOtherProcessWasUsed =
|
||||
aOther.mHandleCreatedByOtherProcessWasUsed;
|
||||
#endif
|
||||
mHandle = aOther.PlatformHandle();
|
||||
} else {
|
||||
DuplicateInCurrentProcess(aOther.PlatformHandle());
|
||||
mHandleCreatedByOtherProcess = false;
|
||||
#ifdef DEBUG
|
||||
mHandleCreatedByOtherProcessWasUsed = false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,9 +157,11 @@ private:
|
|||
// destruction.
|
||||
bool mHandleCreatedByOtherProcess;
|
||||
|
||||
#ifdef DEBUG
|
||||
// This is to ensure that we don't leak the handle (which is only possible
|
||||
// when we're in the receiving process).
|
||||
mutable DebugOnly<bool> mHandleCreatedByOtherProcessWasUsed;
|
||||
mutable bool mHandleCreatedByOtherProcessWasUsed;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace ipc
|
||||
|
|
|
@ -32,7 +32,9 @@ using namespace mozilla::ipc;
|
|||
|
||||
NS_DEFINE_NAMED_CID(NS_TIMER_CID);
|
||||
|
||||
static mozilla::DebugOnly<MessagePump::Delegate*> gFirstDelegate;
|
||||
#ifdef DEBUG
|
||||
static MessagePump::Delegate* gFirstDelegate;
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
@ -253,7 +255,9 @@ MessagePumpForChildProcess::Run(base::MessagePump::Delegate* aDelegate)
|
|||
{
|
||||
if (mFirstRun) {
|
||||
MOZ_ASSERT(aDelegate && !gFirstDelegate);
|
||||
#ifdef DEBUG
|
||||
gFirstDelegate = aDelegate;
|
||||
#endif
|
||||
|
||||
mFirstRun = false;
|
||||
if (NS_FAILED(XRE_RunAppShell())) {
|
||||
|
@ -261,7 +265,9 @@ MessagePumpForChildProcess::Run(base::MessagePump::Delegate* aDelegate)
|
|||
}
|
||||
|
||||
MOZ_ASSERT(aDelegate && aDelegate == gFirstDelegate);
|
||||
#ifdef DEBUG
|
||||
gFirstDelegate = nullptr;
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче