зеркало из https://github.com/mozilla/pjs.git
bug 76339 - kill nsIAppShellComponent, finally. sr=sfraser, r=dveditz
This commit is contained in:
Родитель
c299aa1695
Коммит
0aeede6732
|
@ -807,11 +807,6 @@ sub BuildClientDist()
|
||||||
InstallFromManifest(":mozilla:xpinstall:public:MANIFEST", "$distdirectory:xpinstall:");
|
InstallFromManifest(":mozilla:xpinstall:public:MANIFEST", "$distdirectory:xpinstall:");
|
||||||
InstallFromManifest(":mozilla:xpinstall:cleanup:MANIFEST", "$distdirectory:xpinstall:");
|
InstallFromManifest(":mozilla:xpinstall:cleanup:MANIFEST", "$distdirectory:xpinstall:");
|
||||||
|
|
||||||
|
|
||||||
# XPFE COMPONENTS
|
|
||||||
InstallFromManifest(":mozilla:xpfe:components:public:MANIFEST", "$distdirectory:xpfe:components");
|
|
||||||
InstallFromManifest(":mozilla:xpfe:components:public:MANIFEST_IDL", "$distdirectory:idl:");
|
|
||||||
|
|
||||||
my $dir = '';
|
my $dir = '';
|
||||||
for $dir (qw(bookmarks find history related search shistory sidebar urlbarhistory xfer))
|
for $dir (qw(bookmarks find history related search shistory sidebar urlbarhistory xfer))
|
||||||
{
|
{
|
||||||
|
|
|
@ -88,12 +88,6 @@ interface nsIAppShellService : nsISupports
|
||||||
*/
|
*/
|
||||||
void quit();
|
void quit();
|
||||||
|
|
||||||
/**
|
|
||||||
* Required exit routine. Cleanly shuts down
|
|
||||||
* the appshell components.
|
|
||||||
*/
|
|
||||||
void shutdown();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a window.
|
* Create a window.
|
||||||
* @param aParent the parent window. Can be null.
|
* @param aParent the parent window. Can be null.
|
||||||
|
@ -123,11 +117,6 @@ interface nsIAppShellService : nsISupports
|
||||||
in long aInitialWidth,
|
in long aInitialWidth,
|
||||||
in long aInitialHeight);
|
in long aInitialHeight);
|
||||||
|
|
||||||
/**
|
|
||||||
* Apply Initialize function to each app shell component.
|
|
||||||
*/
|
|
||||||
void enumerateAndInitializeComponents();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close a window.
|
* Close a window.
|
||||||
* @param aWindow a window.
|
* @param aWindow a window.
|
||||||
|
|
|
@ -58,7 +58,6 @@
|
||||||
#include "nsIWebShellWindow.h"
|
#include "nsIWebShellWindow.h"
|
||||||
#include "nsWebShellWindow.h"
|
#include "nsWebShellWindow.h"
|
||||||
|
|
||||||
#include "nsIAppShellComponent.h"
|
|
||||||
#include "nsIRegistry.h"
|
#include "nsIRegistry.h"
|
||||||
#include "nsIEnumerator.h"
|
#include "nsIEnumerator.h"
|
||||||
#include "nsICmdLineService.h"
|
#include "nsICmdLineService.h"
|
||||||
|
@ -299,157 +298,6 @@ nsAppShellService::CreateHiddenWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsAppShellService::EnumerateAndInitializeComponents(void)
|
|
||||||
{
|
|
||||||
// Initialize each registered component.
|
|
||||||
EnumerateComponents( &nsAppShellService::InitializeComponent );
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Apply function (Initialize/Shutdown) to each app shell component.
|
|
||||||
void
|
|
||||||
nsAppShellService::EnumerateComponents( EnumeratorMemberFunction function ) {
|
|
||||||
nsresult rv;
|
|
||||||
nsRegistryKey key;
|
|
||||||
nsCOMPtr<nsIEnumerator> components;
|
|
||||||
const char *failed = "GetService";
|
|
||||||
nsCOMPtr<nsIRegistry> registry =
|
|
||||||
do_GetService(NS_REGISTRY_CONTRACTID, &rv);
|
|
||||||
if ( NS_SUCCEEDED(rv)
|
|
||||||
&&
|
|
||||||
( failed = "Open" )
|
|
||||||
&&
|
|
||||||
NS_SUCCEEDED( ( rv = registry->OpenWellKnownRegistry(nsIRegistry::ApplicationComponentRegistry) ) )
|
|
||||||
&&
|
|
||||||
( failed = "GetSubtree" )
|
|
||||||
&&
|
|
||||||
NS_SUCCEEDED( ( rv = registry->GetSubtree( nsIRegistry::Common,
|
|
||||||
NS_IAPPSHELLCOMPONENT_KEY,
|
|
||||||
&key ) ) )
|
|
||||||
&&
|
|
||||||
( failed = "EnumerateSubtrees" )
|
|
||||||
&&
|
|
||||||
NS_SUCCEEDED( ( rv = registry->EnumerateSubtrees( key,
|
|
||||||
getter_AddRefs(components )) ) )
|
|
||||||
&&
|
|
||||||
( failed = "First" )
|
|
||||||
&&
|
|
||||||
NS_SUCCEEDED( ( rv = components->First() ) ) ) {
|
|
||||||
// Enumerate all subtrees
|
|
||||||
while ( NS_SUCCEEDED( rv ) && (NS_OK != components->IsDone()) ) {
|
|
||||||
nsCOMPtr<nsISupports> base;
|
|
||||||
|
|
||||||
rv = components->CurrentItem( getter_AddRefs(base) );
|
|
||||||
if ( NS_SUCCEEDED( rv ) ) {
|
|
||||||
// Get specific interface.
|
|
||||||
nsCOMPtr<nsIRegistryNode> node;
|
|
||||||
nsIID nodeIID = NS_IREGISTRYNODE_IID;
|
|
||||||
rv = base->QueryInterface( nodeIID,
|
|
||||||
(void**)getter_AddRefs(node) );
|
|
||||||
// Test that result.
|
|
||||||
if ( NS_SUCCEEDED( rv ) ) {
|
|
||||||
// Get node name.
|
|
||||||
char *name;
|
|
||||||
rv = node->GetNameUTF8( &name );
|
|
||||||
if ( NS_SUCCEEDED( rv ) ) {
|
|
||||||
// If this is a CID of a component; apply function to it.
|
|
||||||
nsCID cid;
|
|
||||||
if ( cid.Parse( name ) ) {
|
|
||||||
(this->*function)( cid );
|
|
||||||
} else {
|
|
||||||
// Not a valid CID, ignore it.
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Unable to get subkey name, ignore it.
|
|
||||||
}
|
|
||||||
nsCRT::free(name);
|
|
||||||
} else {
|
|
||||||
// Unable to convert item to registry node, ignore it.
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Unable to get current item, ignore it.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Go on to next component, if this fails, we quit.
|
|
||||||
rv = components->Next();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Unable to set up for subkey enumeration.
|
|
||||||
#ifdef NS_DEBUG
|
|
||||||
printf( "Unable to enumerator app shell components, %s rv=0x%08X\n",
|
|
||||||
failed, (int)rv );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsAppShellService::InitializeComponent( const nsCID &aComponentCID ) {
|
|
||||||
// Attempt to create instance of the component.
|
|
||||||
nsIAppShellComponent *component;
|
|
||||||
nsresult rv = nsComponentManager::CreateInstance( aComponentCID,
|
|
||||||
0,
|
|
||||||
NS_GET_IID(nsIAppShellComponent),
|
|
||||||
(void**)&component );
|
|
||||||
if ( NS_SUCCEEDED( rv ) ) {
|
|
||||||
// Then tell it to initialize (it may RegisterService itself).
|
|
||||||
rv = component->Initialize( this, mCmdLineService );
|
|
||||||
#ifdef NS_DEBUG
|
|
||||||
char *name = aComponentCID.ToString();
|
|
||||||
printf( "Initialized app shell component %s, rv=0x%08X\n",
|
|
||||||
name, (int)rv );
|
|
||||||
Recycle(name);
|
|
||||||
#endif
|
|
||||||
// Release it (will live on if it registered itself as service).
|
|
||||||
component->Release();
|
|
||||||
} else {
|
|
||||||
// Error creating component.
|
|
||||||
#ifdef NS_DEBUG
|
|
||||||
char *name = aComponentCID.ToString();
|
|
||||||
printf( "Error creating app shell component %s, rv=0x%08X\n",
|
|
||||||
name, (int)rv );
|
|
||||||
Recycle(name);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsAppShellService::ShutdownComponent( const nsCID &aComponentCID ) {
|
|
||||||
// Attempt to create instance of the component (must be a service).
|
|
||||||
nsIAppShellComponent *component;
|
|
||||||
nsresult rv = nsServiceManager::GetService( aComponentCID,
|
|
||||||
NS_GET_IID(nsIAppShellComponent),
|
|
||||||
(nsISupports**)&component );
|
|
||||||
if ( NS_SUCCEEDED( rv ) ) {
|
|
||||||
// Instance accessed, tell it to shutdown.
|
|
||||||
rv = component->Shutdown();
|
|
||||||
#ifdef NS_DEBUG
|
|
||||||
char *name = aComponentCID.ToString();
|
|
||||||
printf( "Shut down app shell component %s, rv=0x%08X\n",
|
|
||||||
name, (int)rv );
|
|
||||||
nsCRT::free(name);
|
|
||||||
#endif
|
|
||||||
// Release the service.
|
|
||||||
nsServiceManager::ReleaseService( aComponentCID, component );
|
|
||||||
} else {
|
|
||||||
// Error getting component service (perhaps due to that component not being
|
|
||||||
// a service).
|
|
||||||
#ifdef NS_DEBUG
|
|
||||||
char *name = aComponentCID.ToString();
|
|
||||||
printf( "Unable to shut down app shell component %s, rv=0x%08X\n",
|
|
||||||
name, (int)rv );
|
|
||||||
nsCRT::free(name);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsAppShellService::Run(void)
|
nsAppShellService::Run(void)
|
||||||
{
|
{
|
||||||
|
@ -572,15 +420,6 @@ nsAppShellService::DestroyExitEvent(PLEvent* aEvent)
|
||||||
delete event;
|
delete event;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsAppShellService::Shutdown(void)
|
|
||||||
{
|
|
||||||
// Shutdown all components.
|
|
||||||
EnumerateComponents(&nsAppShellService::ShutdownComponent);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new top level window and display the given URL within it...
|
* Create a new top level window and display the given URL within it...
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -71,10 +71,6 @@ protected:
|
||||||
PRUint32 aChromeMask,
|
PRUint32 aChromeMask,
|
||||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight,
|
PRInt32 aInitialWidth, PRInt32 aInitialHeight,
|
||||||
PRBool aIsHiddenWindow, nsIXULWindow **aResult);
|
PRBool aIsHiddenWindow, nsIXULWindow **aResult);
|
||||||
void InitializeComponent( const nsCID &aComponentCID );
|
|
||||||
void ShutdownComponent( const nsCID &aComponentCID );
|
|
||||||
typedef void (nsAppShellService::*EnumeratorMemberFunction)(const nsCID&);
|
|
||||||
void EnumerateComponents( void (nsAppShellService::*function)(const nsCID&) );
|
|
||||||
nsresult SetXPConnectSafeContext();
|
nsresult SetXPConnectSafeContext();
|
||||||
nsresult ClearXPConnectSafeContext();
|
nsresult ClearXPConnectSafeContext();
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
#include "nsIAppShell.h"
|
#include "nsIAppShell.h"
|
||||||
#include "nsICmdLineService.h"
|
#include "nsICmdLineService.h"
|
||||||
#include "nsIAppShellService.h"
|
#include "nsIAppShellService.h"
|
||||||
#include "nsIAppShellComponent.h"
|
|
||||||
#include "nsIAppStartupNotifier.h"
|
#include "nsIAppStartupNotifier.h"
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
#include "nsAppShellCIDs.h"
|
#include "nsAppShellCIDs.h"
|
||||||
|
@ -1233,11 +1232,6 @@ static nsresult main1(int argc, char* argv[], nsISupports *nativeApp )
|
||||||
NS_TIMELINE_LEAVE("InitializeProfileService");
|
NS_TIMELINE_LEAVE("InitializeProfileService");
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
// Enumerate AppShellComponenets
|
|
||||||
NS_TIMELINE_ENTER("appShell->EnumerateAndInitializeComponents");
|
|
||||||
appShell->EnumerateAndInitializeComponents();
|
|
||||||
NS_TIMELINE_LEAVE("appShell->EnumerateAndInitializeComponents");
|
|
||||||
|
|
||||||
rv = VerifyPsmAbsentOrSane(argc, argv);
|
rv = VerifyPsmAbsentOrSane(argc, argv);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
@ -1298,12 +1292,6 @@ static nsresult main1(int argc, char* argv[], nsISupports *nativeApp )
|
||||||
remoteService->Shutdown();
|
remoteService->Shutdown();
|
||||||
#endif /* MOZ_ENABLE_XREMOTE */
|
#endif /* MOZ_ENABLE_XREMOTE */
|
||||||
|
|
||||||
/*
|
|
||||||
* Shut down the Shell instance... This is done even if the Run(...)
|
|
||||||
* method returned an error.
|
|
||||||
*/
|
|
||||||
(void) appShell->Shutdown();
|
|
||||||
|
|
||||||
NS_TIMELINE_LEAVE("main1");
|
NS_TIMELINE_LEAVE("main1");
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -26,7 +26,7 @@ VPATH = @srcdir@
|
||||||
|
|
||||||
include $(DEPTH)/config/autoconf.mk
|
include $(DEPTH)/config/autoconf.mk
|
||||||
|
|
||||||
DIRS = public bookmarks directory filepicker find history search sidebar related regviewer xfer prefwindow shistory remote console autocomplete urlbarhistory intl build
|
DIRS = bookmarks directory filepicker find history search sidebar related regviewer xfer prefwindow shistory remote console autocomplete urlbarhistory intl build
|
||||||
|
|
||||||
ifdef MOZ_ENABLE_XREMOTE
|
ifdef MOZ_ENABLE_XREMOTE
|
||||||
DIRS += xremote
|
DIRS += xremote
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
DEPTH=..\..
|
DEPTH=..\..
|
||||||
|
|
||||||
DIRS= \
|
DIRS= \
|
||||||
public \
|
|
||||||
bookmarks \
|
bookmarks \
|
||||||
directory \
|
directory \
|
||||||
filepicker \
|
filepicker \
|
||||||
|
|
Загрузка…
Ссылка в новой задаче