Bug 998795: Use nsAutoPtr to initialize MainThreadIOLoggerImpl(); r=froydnj

This commit is contained in:
Aaron Klotz 2014-04-24 20:06:12 -06:00
parent 66e8ec5020
commit 237eb0b915

View File

@ -11,6 +11,7 @@
#include "mozilla/IOInterposer.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/TimeStamp.h"
#include "nsAutoPtr.h"
/**
* This code uses NSPR stuff and STL containers because it must be detached
@ -207,10 +208,11 @@ namespace MainThreadIOLogger {
bool
Init()
{
sImpl = new MainThreadIOLoggerImpl();
if (!sImpl->Init()) {
nsAutoPtr<MainThreadIOLoggerImpl> impl(new MainThreadIOLoggerImpl());
if (!impl->Init()) {
return false;
}
sImpl = impl.forget();
IOInterposer::Register(IOInterposeObserver::OpAllWithStaging, sImpl);
return true;
}