diff options
author | Pale Moon <git-repo@palemoon.org> | 2015-08-29 13:36:14 +0200 |
---|---|---|
committer | Pale Moon <git-repo@palemoon.org> | 2015-08-29 13:38:16 +0200 |
commit | fb321084a3309034e399ea0878ab5580c05df86e (patch) | |
tree | c2954959b9321d32540cca286e168516c3569b3d | |
parent | b97d5626576cab83b765b9718cee289076a9ba0f (diff) | |
download | palemoon-gre-fb321084a3309034e399ea0878ab5580c05df86e.tar.gz |
Remove metro part2: Remove app init code
-rw-r--r-- | browser/app-rules.mk | 3 | ||||
-rw-r--r-- | browser/app/nsBrowserApp.cpp | 133 | ||||
-rw-r--r-- | toolkit/xre/nsAppRunner.cpp | 119 | ||||
-rw-r--r-- | widget/xpwidgets/nsAppShellSingleton.h | 7 | ||||
-rw-r--r-- | xpcom/base/nsDebugImpl.cpp | 10 |
5 files changed, 5 insertions, 267 deletions
diff --git a/browser/app-rules.mk b/browser/app-rules.mk index 9672782a2..2c3165304 100644 --- a/browser/app-rules.mk +++ b/browser/app-rules.mk @@ -1,4 +1 @@ PURGECACHES_DIRS = $(DIST)/bin/browser -ifdef MOZ_METRO -PURGECACHES_DIRS += $(DIST)/bin/metro -endif diff --git a/browser/app/nsBrowserApp.cpp b/browser/app/nsBrowserApp.cpp index 72ef0e25a..d5d2915cb 100644 --- a/browser/app/nsBrowserApp.cpp +++ b/browser/app/nsBrowserApp.cpp @@ -229,33 +229,6 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory) bool metroOnDesktop = false; -#ifdef MOZ_METRO - if (argc > 1) { - // This command-line flag is passed to our executable when it is to be - // launched in metro mode (i.e. our EXE is registered as the default - // browser and the user has tapped our EXE's tile) - if (IsArg(argv[1], "ServerName:DefaultBrowserServer")) { - mainFlags = XRE_MAIN_FLAG_USE_METRO; - argv[1] = argv[0]; - argv++; - argc--; - } else if (IsArg(argv[1], "BackgroundSessionClosed")) { - // This command line flag is used for indirect shutdowns, the OS - // relaunches Metro Firefox with this command line arg. - mainFlags = XRE_MAIN_FLAG_USE_METRO; - } else { - // This command-line flag is used to test the metro browser in a desktop - // environment. - for (int idx = 1; idx < argc; idx++) { - if (IsArg(argv[idx], "metrodesktop")) { - metroOnDesktop = true; - break; - } - } - } - } -#endif - // Desktop browser launch if (mainFlags != XRE_MAIN_FLAG_USE_METRO && !metroOnDesktop) { ScopedAppData appData(&sAppData); @@ -280,112 +253,6 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory) return XRE_main(argc, argv, &appData, mainFlags); } - // Metro browser launch -#ifdef MOZ_METRO - nsCOMPtr<nsIFile> iniFile, appSubdir; - - xreDirectory->Clone(getter_AddRefs(iniFile)); - xreDirectory->Clone(getter_AddRefs(appSubdir)); - - iniFile->Append(NS_LITERAL_STRING(kMetroFolder)); - iniFile->Append(NS_LITERAL_STRING(kMetroAppIniFilename)); - - appSubdir->Append(NS_LITERAL_STRING(kMetroFolder)); - - nsAutoCString path; - if (NS_FAILED(iniFile->GetNativePath(path))) { - Output("Couldn't get ini file path.\n"); - return 255; - } - - char appEnv[MAXPATHLEN]; - snprintf(appEnv, MAXPATHLEN, "XUL_APP_FILE=%s", path.get()); - if (putenv(appEnv)) { - Output("Couldn't set %s.\n", appEnv); - return 255; - } - - nsXREAppData *appData; - rv = XRE_CreateAppData(iniFile, &appData); - if (NS_FAILED(rv) || !appData) { - Output("Couldn't read application.ini"); - return 255; - } - - SetStrongPtr(appData->directory, static_cast<nsIFile*>(appSubdir.get())); - // xreDirectory already has a refcount from NS_NewLocalFile - appData->xreDirectory = xreDirectory; - -#ifdef XP_WIN - if (!metroOnDesktop) { - nsCOMPtr<nsIFile> testFile; - - xreDirectory->Clone(getter_AddRefs(testFile)); - testFile->Append(NS_LITERAL_STRING(kMetroTestFile)); - - nsAutoCString path; - if (NS_FAILED(testFile->GetNativePath(path))) { - Output("Couldn't get test file path.\n"); - return 255; - } - - // Check for a metro test harness command line args file - HANDLE hTestFile = CreateFileA(path.get(), - GENERIC_READ, - 0, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - if (hTestFile != INVALID_HANDLE_VALUE) { - // Typical test harness command line args string is around 100 bytes. - char buffer[1024]; - memset(buffer, 0, sizeof(buffer)); - DWORD bytesRead = 0; - if (!ReadFile(hTestFile, (VOID*)buffer, sizeof(buffer)-1, - &bytesRead, NULL) || !bytesRead) { - CloseHandle(hTestFile); - printf("failed to read test file '%s'", testFile); - return -1; - } - CloseHandle(hTestFile); - - // Build new args array - char* newArgv[20]; - int newArgc = 1; - - memset(newArgv, 0, sizeof(newArgv)); - - char* ptr = buffer; - newArgv[0] = ptr; - while (*ptr != NULL && - (ptr - buffer) < sizeof(buffer) && - newArgc < ARRAYSIZE(newArgv)) { - if (isspace(*ptr)) { - *ptr = '\0'; - ptr++; - newArgv[newArgc] = ptr; - newArgc++; - continue; - } - ptr++; - } - if (ptr == newArgv[newArgc-1]) - newArgc--; - - // attach browser stdout to metrotestharness stdout - AttachToTestHarness(); - - int result = XRE_main(newArgc, newArgv, appData, mainFlags); - XRE_FreeAppData(appData); - return result; - } - } -#endif - - int result = XRE_main(argc, argv, appData, mainFlags); - XRE_FreeAppData(appData); - return result; -#endif - NS_NOTREACHED("browser do_main failed to pickup proper initialization"); return 255; } diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index ed58096a8..a51fb8ec4 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -96,9 +96,6 @@ using mozilla::scache::StartupCache; #include "nsIWinAppHelper.h" #include <windows.h> #include "cairo/cairo-features.h" -#ifdef MOZ_METRO -#include <roapi.h> -#endif #ifndef PROCESS_DEP_ENABLE #define PROCESS_DEP_ENABLE 0x1 @@ -3558,118 +3555,6 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData) return NS_FAILED(rv) ? 1 : 0; } -#if defined(MOZ_METRO) && defined(XP_WIN) -extern bool XRE_MetroCoreApplicationRun(); -static XREMain* xreMainPtr; - -// must be called by the thread we want as the main thread -nsresult -XRE_metroStartup(bool runXREMain) -{ - nsresult rv; - - bool exit = false; - if (xreMainPtr->XRE_mainStartup(&exit) != 0 || exit) - return NS_ERROR_FAILURE; - - // Start the real application - xreMainPtr->mScopedXPCom = new ScopedXPCOMStartup(); - if (!xreMainPtr->mScopedXPCom) - return NS_ERROR_FAILURE; - - rv = xreMainPtr->mScopedXPCom->Initialize(); - NS_ENSURE_SUCCESS(rv, rv); - - if (runXREMain) { - rv = xreMainPtr->XRE_mainRun(); - NS_ENSURE_SUCCESS(rv, rv); - } - return NS_OK; -} - -void -XRE_metroShutdown() -{ - delete xreMainPtr->mScopedXPCom; - xreMainPtr->mScopedXPCom = nullptr; - -#ifdef MOZ_INSTRUMENT_EVENT_LOOP - mozilla::ShutdownEventTracing(); -#endif - - // unlock the profile after ScopedXPCOMStartup object (xpcom) - // has gone out of scope. see bug #386739 for more details - xreMainPtr->mProfileLock->Unlock(); - gProfileLock = nullptr; - - XRE_DeinitCommandLine(); -} - -class WinRTInitWrapper -{ -public: - WinRTInitWrapper() { - mResult = ::RoInitialize(RO_INIT_MULTITHREADED); - } - ~WinRTInitWrapper() { - if (SUCCEEDED(mResult)) { - ::RoUninitialize(); - } - } - HRESULT mResult; -}; - -int -XRE_mainMetro(int argc, char* argv[], const nsXREAppData* aAppData) -{ - char aLocal; - GoannaProfilerInitRAII profilerGuard(&aLocal); - PROFILER_LABEL("Startup", "XRE_Main"); - - nsresult rv = NS_OK; - - xreMainPtr = new XREMain(); - if (!xreMainPtr) { - return 1; - } - - // Inits Winrt and COM underneath it. - WinRTInitWrapper wrap; - - gArgc = argc; - gArgv = argv; - - NS_ENSURE_TRUE(aAppData, 2); - - xreMainPtr->mAppData = new ScopedAppData(aAppData); - if (!xreMainPtr->mAppData) - return 1; - // used throughout this file - gAppData = xreMainPtr->mAppData; - - ScopedLogging log; - - // init - bool exit = false; - if (xreMainPtr->XRE_mainInit(&exit) != 0 || exit) - return 1; - - // Located in widget, will call back into XRE_metroStartup and - // XRE_metroShutdown above. - if (!XRE_MetroCoreApplicationRun()) { - return 1; - } - - // XRE_metroShutdown should have already been called on the worker - // thread that called XRE_metroStartup. - NS_ASSERTION(!xreMainPtr->mScopedXPCom, - "XPCOM Shutdown hasn't occured, and we are exiting."); - return 0; -} - -void SetWindowsEnvironment(WindowsEnvironmentType aEnvID); -#endif // MOZ_METRO || !defined(XP_WIN) - void XRE_DisableWritePoisoning(void) { mozilla::DisableWritePoisoning(); @@ -3678,7 +3563,7 @@ XRE_DisableWritePoisoning(void) { int XRE_main(int argc, char* argv[], const nsXREAppData* aAppData, uint32_t aFlags) { -#if !defined(MOZ_METRO) || !defined(XP_WIN) +#if !defined(XP_WIN) XREMain main; int result = main.XRE_main(argc, argv, aAppData); mozilla::RecordShutdownEndTimeStamp(); @@ -3703,7 +3588,7 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData, uint32_t aFlags) int result = XRE_mainMetro(argc, argv, aAppData); mozilla::RecordShutdownEndTimeStamp(); return result; -#endif // MOZ_METRO || !defined(XP_WIN) +#endif // !defined(XP_WIN) } nsresult diff --git a/widget/xpwidgets/nsAppShellSingleton.h b/widget/xpwidgets/nsAppShellSingleton.h index 84702c028..d22366281 100644 --- a/widget/xpwidgets/nsAppShellSingleton.h +++ b/widget/xpwidgets/nsAppShellSingleton.h @@ -28,9 +28,6 @@ */ #include "nsXULAppAPI.h" -#if defined(MOZ_METRO) && defined(XP_WIN) -#include "winrt/MetroAppShell.h" -#endif static nsIAppShell *sAppShell; @@ -39,7 +36,7 @@ nsAppShellInit() { NS_ASSERTION(!sAppShell, "already initialized"); -#if !defined(MOZ_METRO) || !defined(XP_WIN) +#if !defined(XP_WIN) sAppShell = new nsAppShell(); #else if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) { @@ -53,7 +50,7 @@ nsAppShellInit() NS_ADDREF(sAppShell); nsresult rv; -#if !defined(MOZ_METRO) || !defined(XP_WIN) +#if !defined(XP_WIN) rv = static_cast<nsAppShell*>(sAppShell)->Init(); #else if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) { diff --git a/xpcom/base/nsDebugImpl.cpp b/xpcom/base/nsDebugImpl.cpp index 09a7c2fdc..2fff44c69 100644 --- a/xpcom/base/nsDebugImpl.cpp +++ b/xpcom/base/nsDebugImpl.cpp @@ -38,9 +38,6 @@ #if defined(XP_WIN) #include <tchar.h> #include "nsString.h" -#ifdef MOZ_METRO -#include "nsWindowsHelpers.h" -#endif #endif #if defined(XP_MACOSX) @@ -208,12 +205,7 @@ static nsAssertBehavior GetAssertBehavior() if (gAssertBehavior != NS_ASSERT_UNINITIALIZED) return gAssertBehavior; -#if defined(XP_WIN) && defined(MOZ_METRO) - if (IsRunningInWindowsMetro()) - gAssertBehavior = NS_ASSERT_WARN; - else - gAssertBehavior = NS_ASSERT_TRAP; -#elif defined(XP_WIN) +#if defined(XP_WIN) gAssertBehavior = NS_ASSERT_TRAP; #else gAssertBehavior = NS_ASSERT_WARN; |