зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1337063 - Transfer child's initial ContentDeviceData with SendSetXPCOMProcessAttributes - r=dvander
MozReview-Commit-ID: IWCgL9aCusW --HG-- extra : rebase_source : 31d901f99105224ac7445b487813b010fd643bb9
This commit is contained in:
Родитель
5094da93bf
Коммит
63dbe37188
|
@ -520,7 +520,7 @@ ContentChild::RecvSetXPCOMProcessAttributes(const XPCOMInitData& aXPCOMInit,
|
|||
{
|
||||
mLookAndFeelCache = aLookAndFeelIntCache;
|
||||
InitXPCOM(aXPCOMInit, aInitialData);
|
||||
InitGraphicsDeviceData();
|
||||
InitGraphicsDeviceData(aXPCOMInit.contentDeviceData());
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
@ -952,11 +952,11 @@ ContentChild::AppendProcessId(nsACString& aName)
|
|||
}
|
||||
|
||||
void
|
||||
ContentChild::InitGraphicsDeviceData()
|
||||
ContentChild::InitGraphicsDeviceData(const ContentDeviceData& aData)
|
||||
{
|
||||
// Initialize the graphics platform. This may contact the parent process
|
||||
// to read device preferences.
|
||||
gfxPlatform::GetPlatform();
|
||||
gfxPlatform::InitChild(aData);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
void InitXPCOM(const XPCOMInitData& aXPCOMInit,
|
||||
const mozilla::dom::ipc::StructuredCloneData& aInitialData);
|
||||
|
||||
void InitGraphicsDeviceData();
|
||||
void InitGraphicsDeviceData(const ContentDeviceData& aData);
|
||||
|
||||
static ContentChild* GetSingleton()
|
||||
{
|
||||
|
|
|
@ -2222,6 +2222,8 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
|
|||
SerializeURI(nullptr, xpcomInit.userContentSheetURL());
|
||||
}
|
||||
|
||||
gfxPlatform::GetPlatform()->BuildContentDeviceData(&xpcomInit.contentDeviceData());
|
||||
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
|
||||
if (gfxInfo) {
|
||||
for (int32_t i = 1; i <= nsIGfxInfo::FEATURE_MAX_VALUE; ++i) {
|
||||
|
|
|
@ -265,6 +265,7 @@ struct XPCOMInitData
|
|||
FontFamilyListEntry[] fontFamilies;
|
||||
OptionalURIParams userContentSheetURL;
|
||||
PrefSetting[] prefs;
|
||||
ContentDeviceData contentDeviceData;
|
||||
GfxInfoFeatureStatus[] gfxFeatureStatus;
|
||||
DataStorageEntry[] dataStorage;
|
||||
};
|
||||
|
|
|
@ -47,8 +47,6 @@ ParamTraits<DxgiAdapterDesc>::Write(Message* aMsg, const paramType& aParam)
|
|||
WriteParam(aMsg, aParam.SharedSystemMemory);
|
||||
WriteParam(aMsg, aParam.AdapterLuid.LowPart);
|
||||
WriteParam(aMsg, aParam.AdapterLuid.HighPart);
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE("DxgiAdapterDesc is Windows-only");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -72,10 +70,10 @@ ParamTraits<DxgiAdapterDesc>::Read(const Message* aMsg, PickleIterator* aIter, p
|
|||
{
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE("DxgiAdapterDesc is Windows-only");
|
||||
#endif
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace IPC
|
||||
|
|
|
@ -152,6 +152,8 @@ using namespace mozilla::gfx;
|
|||
gfxPlatform *gPlatform = nullptr;
|
||||
static bool gEverInitialized = false;
|
||||
|
||||
const ContentDeviceData* gContentDeviceInitData = nullptr;
|
||||
|
||||
static Mutex* gGfxPlatformPrefsLock = nullptr;
|
||||
|
||||
// These two may point to the same profile
|
||||
|
@ -528,6 +530,8 @@ gfxPlatform*
|
|||
gfxPlatform::GetPlatform()
|
||||
{
|
||||
if (!gPlatform) {
|
||||
MOZ_RELEASE_ASSERT(!XRE_IsContentProcess(),
|
||||
"Content Process should have called InitChild() before first GetPlatform()");
|
||||
Init();
|
||||
}
|
||||
return gPlatform;
|
||||
|
@ -539,6 +543,19 @@ gfxPlatform::Initialized()
|
|||
return !!gPlatform;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
gfxPlatform::InitChild(const ContentDeviceData& aData)
|
||||
{
|
||||
MOZ_ASSERT(XRE_IsContentProcess());
|
||||
MOZ_RELEASE_ASSERT(!gPlatform,
|
||||
"InitChild() should be called before first GetPlatform()");
|
||||
// Make the provided initial ContentDeviceData available to the init
|
||||
// routines, so they don't have to do a sync request from the parent.
|
||||
gContentDeviceInitData = &aData;
|
||||
Init();
|
||||
gContentDeviceInitData = nullptr;
|
||||
}
|
||||
|
||||
void RecordingPrefChanged(const char *aPrefName, void *aClosure)
|
||||
{
|
||||
if (Preferences::GetBool("gfx.2d.recording", false)) {
|
||||
|
@ -2651,6 +2668,11 @@ gfxPlatform::FetchAndImportContentDeviceData()
|
|||
{
|
||||
MOZ_ASSERT(XRE_IsContentProcess());
|
||||
|
||||
if (gContentDeviceInitData) {
|
||||
ImportContentDeviceData(*gContentDeviceInitData);
|
||||
return;
|
||||
}
|
||||
|
||||
mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton();
|
||||
|
||||
mozilla::gfx::ContentDeviceData data;
|
||||
|
|
|
@ -175,6 +175,12 @@ public:
|
|||
*/
|
||||
static void Shutdown();
|
||||
|
||||
/**
|
||||
* Initialize gfxPlatform (if not already done) in a child process, with
|
||||
* the provided ContentDeviceData.
|
||||
*/
|
||||
static void InitChild(const mozilla::gfx::ContentDeviceData& aData);
|
||||
|
||||
static void InitLayersIPC();
|
||||
static void ShutdownLayersIPC();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче