mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
fixing thread-safety issues
This commit is contained in:
parent
f1df479af5
commit
3c8eae5a14
@ -33,7 +33,6 @@
|
||||
[scriptable, uuid(d63ed30a-a858-11d3-a446-0060b0eb5963)]
|
||||
interface nsPIXPIManagerCallbacks: nsISupports
|
||||
{
|
||||
void DialogOpened(in nsISupports aWindow);
|
||||
void DownloadNext();
|
||||
void CancelInstall();
|
||||
void dialogOpened(in nsISupports aWindow);
|
||||
void cancelInstall();
|
||||
};
|
||||
|
@ -81,7 +81,7 @@ static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
|
||||
|
||||
static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
|
||||
|
||||
static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
static NS_DEFINE_IID(kIStringBundleServiceIID, NS_ISTRINGBUNDLESERVICE_IID);
|
||||
|
||||
#define XPINSTALL_BUNDLE_URL "chrome://xpinstall/locale/xpinstall.properties"
|
||||
@ -176,16 +176,17 @@ nsInstall::nsInstall(nsIZipReader * theJARFile)
|
||||
|
||||
// get the resourced xpinstall string bundle
|
||||
mStringBundle = nsnull;
|
||||
nsIStringBundleService *service;
|
||||
rv = nsServiceManager::GetService( kStringBundleServiceCID,
|
||||
NS_GET_IID(nsIStringBundleService),
|
||||
(nsISupports**) &service );
|
||||
NS_WITH_PROXIED_SERVICE( nsIStringBundleService,
|
||||
service,
|
||||
kStringBundleServiceCID,
|
||||
NS_UI_THREAD_EVENTQ,
|
||||
&rv );
|
||||
|
||||
if (NS_SUCCEEDED(rv) && service)
|
||||
{
|
||||
nsILocale* locale = nsnull;
|
||||
rv = service->CreateBundle( XPINSTALL_BUNDLE_URL, locale,
|
||||
getter_AddRefs(mStringBundle) );
|
||||
nsServiceManager::ReleaseService( kStringBundleServiceCID, service );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID);
|
||||
nsInstallProgressDialog::nsInstallProgressDialog(nsPIXPIManagerCallbacks *aManager)
|
||||
: mManager(aManager)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsInstallProgressDialog::~nsInstallProgressDialog()
|
||||
|
@ -223,20 +223,20 @@ nsXPInstallManager::InitManager(nsXPITriggerInfo* aTriggers)
|
||||
if ( dlg )
|
||||
{
|
||||
rv = dlg->QueryInterface( NS_GET_IID(nsIXPIProgressDlg),
|
||||
getter_AddRefs(mDlg) );
|
||||
getter_AddRefs(Idlg) );
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
NS_WITH_SERVICE( nsIProxyObjectManager, pmgr, kProxyObjectManagerCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = pmgr->GetProxyObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIXPIProgressDlg),
|
||||
mDlg, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs(mProxy) );
|
||||
Idlg, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs(mProxy) );
|
||||
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = mDlg->Open(ioParamBlock);
|
||||
rv = mProxy->Open(ioParamBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -370,8 +370,6 @@ NS_IMETHODIMP nsXPInstallManager::DownloadNext()
|
||||
// can't cancel from here on cause we can't undo installs in a multitrigger
|
||||
if (mProxy)
|
||||
mProxy->StartInstallPhase();
|
||||
else if (mDlg)
|
||||
mDlg->StartInstallPhase();
|
||||
|
||||
NS_WITH_SERVICE(nsISoftwareUpdate, softupdate, nsSoftwareUpdate::GetCID(), &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
@ -422,12 +420,7 @@ void nsXPInstallManager::Shutdown()
|
||||
{
|
||||
// proxy exists: we're being called from script thread
|
||||
mProxy->Close();
|
||||
mProxy = 0;
|
||||
}
|
||||
else if (mDlg)
|
||||
mDlg->Close();
|
||||
|
||||
mDlg = 0;
|
||||
|
||||
// Clean up downloaded files
|
||||
nsXPITriggerItem* item;
|
||||
|
@ -79,14 +79,15 @@ class nsXPInstallManager : public nsIXPINotifier,
|
||||
|
||||
// nsIInterfaceRequestor
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
|
||||
|
||||
//nsPIXPIMANAGERCALLBACKS
|
||||
NS_DECL_NSPIXPIMANAGERCALLBACKS
|
||||
|
||||
|
||||
private:
|
||||
void Shutdown();
|
||||
void LoadDialogWithNames(nsIDialogParamBlock* ioParamBlock);
|
||||
NS_IMETHOD DownloadNext();
|
||||
void Shutdown();
|
||||
void LoadDialogWithNames(nsIDialogParamBlock* ioParamBlock);
|
||||
|
||||
nsXPITriggerInfo* mTriggers;
|
||||
nsXPITriggerItem* mItem;
|
||||
@ -96,7 +97,6 @@ class nsXPInstallManager : public nsIXPINotifier,
|
||||
PRBool mCancelled;
|
||||
PRInt32 mContentLength;
|
||||
|
||||
nsCOMPtr<nsIXPIProgressDlg> mDlg;
|
||||
nsCOMPtr<nsIXPIProgressDlg> mProxy;
|
||||
nsCOMPtr<nsIStringBundle> mStringBundle;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user