зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1550422
- P2. add shared pref serializer/deserializer to GPU process. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D30587 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
324fd6ce12
Коммит
f21aa87190
|
@ -11,6 +11,7 @@
|
|||
#include "nsITimer.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "VRGPUChild.h"
|
||||
#include "ProcessUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
@ -35,6 +36,12 @@ bool GPUProcessHost::Launch(StringVector aExtraOpts) {
|
|||
MOZ_ASSERT(!mGPUChild);
|
||||
MOZ_ASSERT(!gfxPlatform::IsHeadless());
|
||||
|
||||
mPrefSerializer = MakeUnique<ipc::SharedPreferenceSerializer>();
|
||||
if (!mPrefSerializer->SerializeToSharedMemory()) {
|
||||
return false;
|
||||
}
|
||||
mPrefSerializer->AddSharedPrefCmdLineArgs(*this, aExtraOpts);
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
mSandboxLevel = Preferences::GetInt("security.sandbox.gpu.level");
|
||||
#endif
|
||||
|
@ -123,6 +130,7 @@ void GPUProcessHost::InitAfterConnect(bool aSucceeded) {
|
|||
MOZ_ASSERT(!mGPUChild);
|
||||
|
||||
mLaunchPhase = LaunchPhase::Complete;
|
||||
mPrefSerializer = nullptr;
|
||||
|
||||
if (aSucceeded) {
|
||||
mProcessToken = ++sProcessTokenCounter;
|
||||
|
|
|
@ -13,6 +13,11 @@
|
|||
#include "mozilla/ipc/ProtocolUtils.h"
|
||||
#include "mozilla/ipc/TaskFactory.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
class SharedPreferenceSerializer;
|
||||
}
|
||||
} // namespace mozilla
|
||||
class nsITimer;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -122,6 +127,8 @@ class GPUProcessHost final : public mozilla::ipc::GeckoChildProcessHost {
|
|||
UniquePtr<GPUChild> mGPUChild;
|
||||
uint64_t mProcessToken;
|
||||
|
||||
UniquePtr<mozilla::ipc::SharedPreferenceSerializer> mPrefSerializer;
|
||||
|
||||
bool mShutdownRequested;
|
||||
bool mChannelClosed;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "GPUProcessImpl.h"
|
||||
#include "mozilla/ipc/IOThreadChild.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "ProcessUtils.h"
|
||||
|
||||
#if defined(OS_WIN) && defined(MOZ_SANDBOX)
|
||||
# include "mozilla/sandboxTarget.h"
|
||||
|
@ -26,15 +27,48 @@ bool GPUProcessImpl::Init(int aArgc, char* aArgv[]) {
|
|||
mozilla::SandboxTarget::Instance()->StartSandbox();
|
||||
#endif
|
||||
char* parentBuildID = nullptr;
|
||||
char* prefsHandle = nullptr;
|
||||
char* prefMapHandle = nullptr;
|
||||
char* prefsLen = nullptr;
|
||||
char* prefMapSize = nullptr;
|
||||
for (int i = 1; i < aArgc; i++) {
|
||||
if (!aArgv[i]) {
|
||||
continue;
|
||||
}
|
||||
if (strcmp(aArgv[i], "-parentBuildID") == 0) {
|
||||
parentBuildID = aArgv[i + 1];
|
||||
|
||||
#ifdef XP_WIN
|
||||
} else if (strcmp(aArgv[i], "-prefsHandle") == 0) {
|
||||
if (++i == aArgc) {
|
||||
return false;
|
||||
}
|
||||
prefsHandle = aArgv[i];
|
||||
} else if (strcmp(aArgv[i], "-prefMapHandle") == 0) {
|
||||
if (++i == aArgc) {
|
||||
return false;
|
||||
}
|
||||
prefMapHandle = aArgv[i];
|
||||
#endif
|
||||
} else if (strcmp(aArgv[i], "-prefsLen") == 0) {
|
||||
if (++i == aArgc) {
|
||||
return false;
|
||||
}
|
||||
prefsLen = aArgv[i];
|
||||
} else if (strcmp(aArgv[i], "-prefMapSize") == 0) {
|
||||
if (++i == aArgc) {
|
||||
return false;
|
||||
}
|
||||
prefMapSize = aArgv[i];
|
||||
}
|
||||
}
|
||||
|
||||
SharedPreferenceDeserializer deserializer;
|
||||
if (!deserializer.DeserializeFromSharedMemory(prefsHandle, prefMapHandle,
|
||||
prefsLen, prefMapSize)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return mGPU.Init(ParentPid(), parentBuildID, IOThreadChild::message_loop(),
|
||||
IOThreadChild::channel());
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче