fixing thread-safety issues
This commit is contained in:
Родитель
767e2f833f
Коммит
4bad08f753
|
@ -1,39 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Don Bragg <dbragg@netscape.com>
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* nsPIXPIManagerCallbacks
|
||||
*
|
||||
* Private interface to allow the XPInstall XUL progress dialog to talk
|
||||
* to the native progress dialog implementation.
|
||||
*/
|
||||
[scriptable, uuid(d63ed30a-a858-11d3-a446-0060b0eb5963)]
|
||||
interface nsPIXPIManagerCallbacks: nsISupports
|
||||
{
|
||||
void DialogOpened(in nsISupports aWindow);
|
||||
void DownloadNext();
|
||||
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;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче