Bug 1024259: Use NS_FREE_PERMANENT_DATA more consistently. r=mccr8

This commit is contained in:
Jesse Ruderman 2015-07-31 12:11:48 -07:00
parent ee65a72042
commit 5e6905f92a
6 changed files with 20 additions and 14 deletions

View File

@ -193,6 +193,7 @@
#include "mozilla/RemoteSpellCheckEngineChild.h"
#include "GMPServiceChild.h"
#include "gfxPlatform.h"
#include "nscore.h" // for NS_FREE_PERMANENT_DATA
using namespace mozilla;
using namespace mozilla::docshell;
@ -1897,7 +1898,7 @@ ContentChild::ActorDestroy(ActorDestroyReason why)
QuickExit();
}
#if !defined(DEBUG) && !defined(MOZ_ASAN)
#ifndef NS_FREE_PERMANENT_DATA
// In release builds, there's no point in the content process
// going through the full XPCOM shutdown path, because it doesn't
// keep persistent state.

View File

@ -111,6 +111,7 @@ class mozilla::gl::SkiaGLGlue : public GenericAtomicRefCounted {
#include "nsIXULRuntime.h"
#include "VsyncSource.h"
#include "SoftwareVsyncSource.h"
#include "nscore.h" // for NS_FREE_PERMANENT_DATA
namespace mozilla {
namespace layers {
@ -259,7 +260,7 @@ void CrashStatsLogForwarder::UpdateCrashReport()
mCrashCriticalKey.get(), message.str().c_str());
}
}
void CrashStatsLogForwarder::Log(const std::string& aString)
{
MutexAutoLock lock(mMutex);
@ -645,7 +646,7 @@ gfxPlatform::Shutdown()
#endif
// This is a bit iffy - we're assuming that we were the ones that set the
// log forwarder in the Factory, so that it's our responsibility to
// log forwarder in the Factory, so that it's our responsibility to
// delete it.
delete mozilla::gfx::Factory::GetLogForwarder();
mozilla::gfx::Factory::SetLogForwarder(nullptr);
@ -714,7 +715,7 @@ gfxPlatform::~gfxPlatform()
// cairo_debug_* function unconditionally.
//
// because cairo can assert and thus crash on shutdown, don't do this in release builds
#if defined(DEBUG) || defined(NS_BUILD_REFCNT_LOGGING) || defined(MOZ_VALGRIND)
#ifdef NS_FREE_PERMANENT_DATA
#ifdef USE_SKIA
// must do Skia cleanup before Cairo cleanup, because Skia may be referencing
// Cairo objects e.g. through SkCairoFTTypeface
@ -1201,7 +1202,7 @@ gfxPlatform::CreateDrawTargetForData(unsigned char* aData, const IntSize& aSize,
NS_ASSERTION(mContentBackend != BackendType::NONE, "No backend.");
BackendType backendType = mContentBackend;
if (!Factory::DoesBackendSupportDataDrawtarget(mContentBackend)) {
backendType = BackendType::CAIRO;
}

View File

@ -47,6 +47,7 @@
#include "nsClassHashtable.h"
#include "nsHashKeys.h"
#include "nsNativeCharsetUtils.h"
#include "nscore.h" // for NS_FREE_PERMANENT_DATA
using mozilla::MonitorAutoLock;
using mozilla::ipc::GeckoChildProcessHost;
@ -125,7 +126,7 @@ GeckoChildProcessHost::~GeckoChildProcessHost()
SharedMemoryBasic::CleanupForPid(mChildProcessHandle);
#endif
ProcessWatcher::EnsureProcessTerminated(mChildProcessHandle
#if defined(NS_BUILD_REFCNT_LOGGING) || defined(MOZ_ASAN)
#ifdef NS_FREE_PERMANENT_DATA
// If we're doing leak logging, shutdown can be slow.
, false // don't "force"
#endif
@ -382,7 +383,7 @@ GeckoChildProcessHost::WaitUntilConnected(int32_t aTimeoutMs)
{
// NB: this uses a different mechanism than the chromium parent
// class.
PRIntervalTime timeoutTicks = (aTimeoutMs > 0) ?
PRIntervalTime timeoutTicks = (aTimeoutMs > 0) ?
PR_MillisecondsToInterval(aTimeoutMs) : PR_INTERVAL_NO_TIMEOUT;
MonitorAutoLock lock(mMonitor);

View File

@ -2477,7 +2477,9 @@ pref("plugin.sessionPermissionNow.intervalInMinutes", 60);
// to allow it persistently.
pref("plugin.persistentPermissionAlways.intervalInDays", 90);
#if !defined(DEBUG) && !defined(MOZ_ASAN)
// Set IPC timeouts for plugins and tabs, except in leak-checking builds.
// (NS_FREE_PERMANENT_DATA is C++ only, so approximate its definition here.)
#if !defined(DEBUG) && !defined(MOZ_ASAN) && !defined(MOZ_VALGRIND)
// How long a plugin is allowed to process a synchronous IPC message
// before we consider it "hung".
pref("dom.ipc.plugins.timeoutSecs", 45);
@ -2503,7 +2505,7 @@ pref("dom.ipc.plugins.hangUIMinDisplaySecs", 10);
// we fear the worst and kill it.
pref("dom.ipc.tabs.shutdownTimeoutSecs", 5);
#else
// No timeout in DEBUG or ASan builds
// No timeout in leak-checking builds
pref("dom.ipc.plugins.timeoutSecs", 0);
pref("dom.ipc.plugins.contentTimeoutSecs", 0);
pref("dom.ipc.plugins.processLaunchTimeoutSecs", 0);

View File

@ -234,7 +234,7 @@
* sense to touch memory pages and free that memory at shutdown,
* unless we are running leak stats.
*/
#if defined(NS_BUILD_REFCNT_LOGGING) || defined(MOZ_VALGRIND)
#if defined(NS_BUILD_REFCNT_LOGGING) || defined(MOZ_VALGRIND) || defined(MOZ_ASAN)
#define NS_FREE_PERMANENT_DATA
#endif

View File

@ -16,6 +16,7 @@
#include "mozilla/RefPtr.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/ThreadLocal.h"
#include "nscore.h" // for NS_FREE_PERMANENT_DATA
#if !defined(XP_WIN)
#include "NSPRInterposer.h"
#endif // !defined(XP_WIN)
@ -460,10 +461,10 @@ IOInterposeObserver::IsMainThread()
void
IOInterposer::Clear()
{
/* Clear() is a no-op on opt builds so that we may continue to trap I/O until
process termination. In debug builds we need to shut down IOInterposer so
that all references are properly released and refcnt log remains clean. */
#if defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING) || defined(MOZ_ASAN)
/* Clear() is a no-op on release builds so that we may continue to trap I/O
until process termination. In leak-checking builds, we need to shut down
IOInterposer so that all references are properly released. */
#ifdef NS_FREE_PERMANENT_DATA
UnregisterCurrentThread();
sMasterList = nullptr;
#endif