зеркало из https://github.com/mozilla/pjs.git
Bug 239925 - fix static initializers in DOM/widget/libpr0n so that we can restart XPCOM safely r=jst sr=darin
This commit is contained in:
Родитель
7b30a5de99
Коммит
14bf5bab31
|
@ -44,7 +44,6 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsIProfileChangeStatus.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsLayoutStylesheetCache, nsIObserver)
|
||||
|
||||
|
|
|
@ -251,6 +251,7 @@ void
|
|||
CSSLoaderImpl::Shutdown()
|
||||
{
|
||||
delete gParsers;
|
||||
gParsers = nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -1280,10 +1280,6 @@ nsDOMClassInfo::RegisterExternalClasses()
|
|||
#define _DOM_CLASSINFO_MAP_BEGIN(_class, _ifptr, _has_class_if) \
|
||||
{ \
|
||||
nsDOMClassInfoData &d = sClassInfoData[eDOMClassInfo_##_class##_id]; \
|
||||
NS_ASSERTION(!d.mProtoChainInterface, "Redeclaration of DOM classinfo " \
|
||||
"proto chain interface!"); \
|
||||
NS_ASSERTION(!d.mInterfaces, "Redeclaration of DOM classinfo " \
|
||||
"interface list!"); \
|
||||
d.mProtoChainInterface = _ifptr; \
|
||||
d.mHasClassInterface = _has_class_if; \
|
||||
static const nsIID *interface_list[] = {
|
||||
|
@ -2963,6 +2959,7 @@ nsDOMClassInfo::ShutDown()
|
|||
|
||||
NS_IF_RELEASE(sXPConnect);
|
||||
NS_IF_RELEASE(sSecMan);
|
||||
sIsInitialized = PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -111,6 +111,8 @@ static PRLogModuleInfo* gJSDiagnostics;
|
|||
#define NS_GC_DELAY 2000 // ms
|
||||
#define NS_FIRST_GC_DELAY 10000 // ms
|
||||
|
||||
// if you add statics here, add them to the list in nsJSEnvironment::Startup
|
||||
|
||||
static nsITimer *sGCTimer;
|
||||
static PRBool sReadyForGC;
|
||||
|
||||
|
@ -126,6 +128,7 @@ static PRThread *gDOMThread;
|
|||
|
||||
static JSGCCallback gOldJSGCCallback;
|
||||
|
||||
static PRBool sIsInitialized;
|
||||
static PRBool sDidShutdown;
|
||||
|
||||
static PRInt32 sContextCount;
|
||||
|
@ -1915,13 +1918,30 @@ DOMGCCallback(JSContext *cx, JSGCStatus status)
|
|||
return gOldJSGCCallback ? gOldJSGCCallback(cx, status) : JS_TRUE;
|
||||
}
|
||||
|
||||
//static
|
||||
void
|
||||
nsJSEnvironment::Startup()
|
||||
{
|
||||
// initialize all our statics, so that we can restart XPCOM
|
||||
sGCTimer = nsnull;
|
||||
sReadyForGC = PR_FALSE;
|
||||
gNameSpaceManager = nsnull;
|
||||
sRuntimeService = nsnull;
|
||||
sRuntime = nsnull;
|
||||
gDOMThread = nsnull;
|
||||
gOldJSGCCallback = nsnull;
|
||||
sIsInitialized = PR_FALSE;
|
||||
sDidShutdown = PR_FALSE;
|
||||
sContextCount = 0;
|
||||
sSecurityManager = nsnull;
|
||||
gCollation = nsnull;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
nsJSEnvironment::Init()
|
||||
{
|
||||
static PRBool isInitialized;
|
||||
|
||||
if (isInitialized) {
|
||||
if (sIsInitialized) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1991,7 +2011,7 @@ nsJSEnvironment::Init()
|
|||
|
||||
rv = CallGetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &sSecurityManager);
|
||||
|
||||
isInitialized = NS_SUCCEEDED(rv);
|
||||
sIsInitialized = NS_SUCCEEDED(rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -179,6 +179,9 @@ private:
|
|||
static JSRuntime *sRuntime;
|
||||
|
||||
public:
|
||||
// called from the module Ctor to initialize statics
|
||||
static void Startup();
|
||||
|
||||
static nsresult Init();
|
||||
|
||||
static nsJSEnvironment *GetScriptingEnvironment();
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
#include "nsIXBLService.h"
|
||||
#include "nsIFrameLoader.h"
|
||||
#include "nsICaret.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsPlainTextSerializer.h"
|
||||
#include "mozSanitizingSerializer.h"
|
||||
|
@ -255,7 +256,8 @@ Initialize(nsIModule* aSelf)
|
|||
}
|
||||
|
||||
gInitialized = PR_TRUE;
|
||||
|
||||
|
||||
nsJSEnvironment::Startup();
|
||||
nsresult rv = nsContentUtils::Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Could not initialize nsContentUtils");
|
||||
|
|
|
@ -251,6 +251,7 @@ void
|
|||
CSSLoaderImpl::Shutdown()
|
||||
{
|
||||
delete gParsers;
|
||||
gParsers = nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsIProfileChangeStatus.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsLayoutStylesheetCache, nsIObserver)
|
||||
|
||||
|
|
|
@ -100,6 +100,7 @@ void nsGifShutdown()
|
|||
{
|
||||
// Release cached buffers from zlib allocator
|
||||
delete gGifAllocator;
|
||||
gGifAllocator = nsnull;
|
||||
}
|
||||
|
||||
#define MAX_HOLD 768 /* for now must be big enough for a cmap */
|
||||
|
|
|
@ -393,6 +393,7 @@ nsWindow::ReleaseGlobals()
|
|||
gsGtkCursorCache[i] = nsnull;
|
||||
}
|
||||
}
|
||||
gGlobalsInitialized = PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWindow::Destroy(void)
|
||||
|
|
Загрузка…
Ссылка в новой задаче