Bug 833935 - Stop using one static var per compilation unit. r=jdm

This commit is contained in:
Jason Duell 2013-01-25 19:28:00 +00:00
parent 8b848b2b7f
commit ec242ba8a0
3 changed files with 29 additions and 6 deletions

View File

@ -35,6 +35,7 @@ EXPORTS_mozilla/net = \
$(NULL)
CPPSRCS = \
NeckoCommon.cpp \
NeckoChild.cpp \
NeckoParent.cpp \
ChannelEventQueue.cpp \

View File

@ -0,0 +1,19 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et tw=80 : */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "NeckoCommon.h"
namespace mozilla {
namespace net {
namespace NeckoCommonInternal {
bool gSecurityDisabled = true;
bool gRegisteredBool = false;
}
} // namespace net
} // namespace mozilla

View File

@ -100,19 +100,22 @@ IsNeckoChild()
return amChild;
}
namespace NeckoCommonInternal {
extern bool gSecurityDisabled;
extern bool gRegisteredBool;
}
// This should always return true unless xpcshell tests are being used
inline bool
UsingNeckoIPCSecurity()
{
static bool securityDisabled = true;
static bool registeredBool = false;
if (!registeredBool) {
Preferences::AddBoolVarCache(&securityDisabled,
if (!NeckoCommonInternal::gRegisteredBool) {
Preferences::AddBoolVarCache(&NeckoCommonInternal::gSecurityDisabled,
"network.disable.ipc.security");
registeredBool = true;
NeckoCommonInternal::gRegisteredBool = true;
}
return !securityDisabled;
return !NeckoCommonInternal::gSecurityDisabled;
}
inline bool