diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index cd91eb8a693a..34740a8b079e 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -41,6 +41,11 @@ * * ***** END LICENSE BLOCK ***** */ +#ifdef MOZ_IPC +#include "mozilla/dom/ContentParent.h" +using mozilla::dom::ContentParent; +#endif + #if defined(XP_OS2) && defined(MOZ_OS2_HIGH_MEMORY) // os2safe.h has to be included before os2.h, needed for high mem #include @@ -763,6 +768,18 @@ nsXULAppInfo::GetProcessType(PRUint32* aResult) return NS_OK; } +NS_IMETHODIMP +nsXULAppInfo::EnsureContentProcess() +{ + if (XRE_GetProcessType() != GeckoProcessType_Default) + return NS_ERROR_NOT_AVAILABLE; + + ContentParent* c = ContentParent::GetSingleton(); + if (!c) + return NS_ERROR_NOT_AVAILABLE; + return NS_OK; +} + NS_IMETHODIMP nsXULAppInfo::InvalidateCachesOnRestart() { diff --git a/xpcom/system/nsIXULRuntime.idl b/xpcom/system/nsIXULRuntime.idl index 39f91d61d33c..69c2a8b7c503 100644 --- a/xpcom/system/nsIXULRuntime.idl +++ b/xpcom/system/nsIXULRuntime.idl @@ -44,7 +44,7 @@ * stable/frozen, please contact Benjamin Smedberg. */ -[scriptable, uuid(cb6078bb-c6b3-4f35-acfd-3b4efa934484)] +[scriptable, uuid(7685dac8-3637-4660-a544-928c5ec0e714)] interface nsIXULRuntime : nsISupports { /** @@ -107,4 +107,13 @@ interface nsIXULRuntime : nsISupports * fastload data to be re-created. */ void invalidateCachesOnRestart(); + + /** + * Starts a child process. This method is intented to pre-start a + * content child process so that when it is actually needed, it is + * ready to go. + * + * @throw NS_ERROR_NOT_AVAILABLE if not available. + */ + void ensureContentProcess(); };