Skip to content

Commit

Permalink
[sailfishos][embedlite] Bring back tookit/xre changes
Browse files Browse the repository at this point in the history
Sha1:  367d2af
Author:  Tatiana Meshkova <tanya.meshkova@gmail.com>
Date:    (6 years ago) 2014-11-24 19:39:51 -0800
Subject: Implemented XPCOM initialization in Process backend
  • Loading branch information
rainemak committed May 27, 2020
1 parent 0eeada5 commit 74cead2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions toolkit/xre/moz.build
Expand Up @@ -151,6 +151,7 @@ LOCAL_INCLUDES += [
'/config',
'/dom/base',
'/dom/ipc',
'/embedding/embedlite/embedprocess',
'/testing/gtest/mozilla',
'/toolkit/crashreporter',
'/xpcom/build',
Expand Down
2 changes: 2 additions & 0 deletions toolkit/xre/nsAppRunner.cpp
Expand Up @@ -1476,13 +1476,15 @@ ScopedXPCOMStartup::Initialize()
NS_ERROR("Couldn't start xpcom!");
mServiceManager = nullptr;
}
#ifdef DEBUG
else {
#ifdef DEBUG
nsCOMPtr<nsIComponentRegistrar> reg =
do_QueryInterface(mServiceManager);
NS_ASSERTION(reg, "Service Manager doesn't QI to Registrar.");
#endif
}
#endif

return rv;
}
Expand Down
22 changes: 20 additions & 2 deletions toolkit/xre/nsEmbedFunctions.cpp
Expand Up @@ -66,6 +66,7 @@
#include "mozilla/dom/ContentProcess.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ContentChild.h"
#include "EmbedLiteContentProcess.h"

#include "mozilla/ipc/TestShellParent.h"
#include "mozilla/ipc/XPCShellEnvironment.h"
Expand Down Expand Up @@ -224,6 +225,7 @@ XRE_ChildProcessTypeToString(GeckoProcessType aProcessType)
namespace mozilla {
namespace startup {
GeckoProcessType sChildProcessType = GeckoProcessType_Default;
bool sIsEmbedlite = false;
} // namespace startup
} // namespace mozilla

Expand Down Expand Up @@ -611,9 +613,16 @@ XRE_InitChildProcess(int aArgc,
break;

case GeckoProcessType_Content: {
process = new ContentProcess(parentPID);
for (int idx = aArgc; idx > 0; idx--) {
if (aArgv[idx] && !strcmp(aArgv[idx], "-embedlite")) {
startup::sIsEmbedlite = true;
break;
}
}

// If passed in grab the application path for xpcom init
bool foundAppdir = false;
nsCString appDir;

#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
// If passed in grab the profile path for sandboxing
Expand All @@ -626,7 +635,6 @@ XRE_InitChildProcess(int aArgc,
if (foundAppdir) {
continue;
}
nsCString appDir;
appDir.Assign(nsDependentCString(aArgv[idx+1]));
static_cast<ContentProcess*>(process.get())->SetAppDir(appDir);
foundAppdir = true;
Expand All @@ -649,6 +657,16 @@ XRE_InitChildProcess(int aArgc,
}
#endif /* XP_MACOSX && MOZ_CONTENT_SANDBOX */
}

if (startup::sIsEmbedlite) {
// Embedlite process does not have shared content parent process with Gecko stuff, so these child should behave as normal Gecko default process
sChildProcessType = GeckoProcessType_Default;
process = new mozilla::embedlite::EmbedLiteContentProcess(parentPID);
static_cast<mozilla::embedlite::EmbedLiteContentProcess*>(process.get())->SetAppDir(appDir);
} else {
process = new ContentProcess(parentPID);
static_cast<ContentProcess*>(process.get())->SetAppDir(appDir);
}
}
break;

Expand Down

0 comments on commit 74cead2

Please sign in to comment.