Bug 1859625 Part 3: Stop sending the GetOutputColorProfileData message. r=ipc-reviewers,mccr8

Differential Revision: https://phabricator.services.mozilla.com/D193139
This commit is contained in:
Brad Werth 2023-11-27 21:11:10 +00:00
parent 7ae9549693
commit cb5944eb4c
8 changed files with 37 additions and 53 deletions

View file

@ -5914,13 +5914,6 @@ mozilla::ipc::IPCResult ContentParent::RecvShutdownPerfStats(
return IPC_OK(); return IPC_OK();
} }
mozilla::ipc::IPCResult ContentParent::RecvGetOutputColorProfileData(
nsTArray<uint8_t>* aOutputColorProfileData) {
(*aOutputColorProfileData) =
gfxPlatform::GetPlatform()->GetPlatformCMSOutputProfileData();
return IPC_OK();
}
mozilla::ipc::IPCResult ContentParent::RecvGetFontListShmBlock( mozilla::ipc::IPCResult ContentParent::RecvGetFontListShmBlock(
const uint32_t& aGeneration, const uint32_t& aIndex, const uint32_t& aGeneration, const uint32_t& aIndex,
base::SharedMemoryHandle* aOut) { base::SharedMemoryHandle* aOut) {

View file

@ -1133,9 +1133,6 @@ class ContentParent final : public PContentParent,
mozilla::ipc::IPCResult RecvShutdownPerfStats(const nsACString& aPerfStats); mozilla::ipc::IPCResult RecvShutdownPerfStats(const nsACString& aPerfStats);
mozilla::ipc::IPCResult RecvGetOutputColorProfileData(
nsTArray<uint8_t>* aOutputColorProfileData);
mozilla::ipc::IPCResult RecvGetFontListShmBlock( mozilla::ipc::IPCResult RecvGetFontListShmBlock(
const uint32_t& aGeneration, const uint32_t& aIndex, const uint32_t& aGeneration, const uint32_t& aIndex,
base::SharedMemoryHandle* aOut); base::SharedMemoryHandle* aOut);

View file

@ -1330,15 +1330,6 @@ parent:
*/ */
async ShutdownPerfStats(nsCString aPerfStats); async ShutdownPerfStats(nsCString aPerfStats);
/**
* Request a buffer containing the contents of the output color profile.
* If set, this is the file pointed to by
* gfx.color_management.display_profile, otherwise it contains a
* platform-specific default
*/
sync GetOutputColorProfileData()
returns (uint8_t[] aOutputColorProfileData);
/** /**
* A shared font list (see gfx/thebes/SharedFontList.*) contains a list * A shared font list (see gfx/thebes/SharedFontList.*) contains a list
* of shared-memory blocks that are used to store all the font list data. * of shared-memory blocks that are used to store all the font list data.

View file

@ -174,6 +174,7 @@ gfxPlatform* gPlatform = nullptr;
static bool gEverInitialized = false; static bool gEverInitialized = false;
const ContentDeviceData* gContentDeviceInitData = nullptr; const ContentDeviceData* gContentDeviceInitData = nullptr;
Maybe<nsTArray<uint8_t>> gCMSOutputProfileData;
Atomic<bool, MemoryOrdering::ReleaseAcquire> gfxPlatform::gCMSInitialized; Atomic<bool, MemoryOrdering::ReleaseAcquire> gfxPlatform::gCMSInitialized;
CMSMode gfxPlatform::gCMSMode = CMSMode::Off; CMSMode gfxPlatform::gCMSMode = CMSMode::Off;
@ -2060,6 +2061,10 @@ const mozilla::gfx::ContentDeviceData* gfxPlatform::GetInitContentDeviceData() {
return gContentDeviceInitData; return gContentDeviceInitData;
} }
Maybe<nsTArray<uint8_t>>& gfxPlatform::GetCMSOutputProfileData() {
return gCMSOutputProfileData;
}
CMSMode GfxColorManagementMode() { CMSMode GfxColorManagementMode() {
const auto mode = StaticPrefs::gfx_color_management_mode(); const auto mode = StaticPrefs::gfx_color_management_mode();
if (mode >= 0 && mode < UnderlyingValue(CMSMode::AllCount)) { if (mode >= 0 && mode < UnderlyingValue(CMSMode::AllCount)) {
@ -3888,6 +3893,8 @@ void gfxPlatform::ImportContentDeviceData(
const DevicePrefs& prefs = aData.prefs(); const DevicePrefs& prefs = aData.prefs();
gfxConfig::Inherit(Feature::HW_COMPOSITING, prefs.hwCompositing()); gfxConfig::Inherit(Feature::HW_COMPOSITING, prefs.hwCompositing());
gfxConfig::Inherit(Feature::OPENGL_COMPOSITING, prefs.oglCompositing()); gfxConfig::Inherit(Feature::OPENGL_COMPOSITING, prefs.oglCompositing());
gCMSOutputProfileData = Some(aData.cmsOutputProfileData().Clone());
} }
void gfxPlatform::BuildContentDeviceData( void gfxPlatform::BuildContentDeviceData(

View file

@ -888,6 +888,13 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
*/ */
const mozilla::gfx::ContentDeviceData* GetInitContentDeviceData(); const mozilla::gfx::ContentDeviceData* GetInitContentDeviceData();
/**
* If inside a child process and have ever received a
* SetXPCOMProcessAttributes message, this contains the cmsOutputProfileData
* from that message.
*/
mozilla::Maybe<nsTArray<uint8_t>>& GetCMSOutputProfileData();
/** /**
* Increase the global device counter after a device has been removed/reset. * Increase the global device counter after a device has been removed/reset.
*/ */

View file

@ -560,23 +560,16 @@ nsTArray<uint8_t> gfxPlatformGtk::GetPlatformCMSOutputProfileData() {
} }
if (XRE_IsContentProcess()) { if (XRE_IsContentProcess()) {
MOZ_ASSERT(NS_IsMainThread()); auto& cmsOutputProfileData = GetCMSOutputProfileData();
// This will be passed in during InitChild so we can avoid sending a // We should have set our profile data when we received our initial
// sync message back to the parent during init. // ContentDeviceData.
const mozilla::gfx::ContentDeviceData* contentDeviceData = MOZ_ASSERT(cmsOutputProfileData.isSome(),
GetInitContentDeviceData(); "Should have created output profile data when we received "
if (contentDeviceData) { "initial content device data.");
// On Windows, we assert that the profile isn't empty, but on if (cmsOutputProfileData.isSome()) {
// Linux it can legitimately be empty if the display isn't return cmsOutputProfileData.ref().Clone();
// calibrated. Thus, no assertion here.
return contentDeviceData->cmsOutputProfileData().Clone();
} }
return nsTArray<uint8_t>();
// Otherwise we need to ask the parent for the updated color profile
mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton();
nsTArray<uint8_t> result;
Unused << cc->SendGetOutputColorProfileData(&result);
return result;
} }
if (!mIsX11Display) { if (!mIsX11Display) {

View file

@ -986,20 +986,21 @@ void gfxWindowsPlatform::CheckForContentOnlyDeviceReset() {
nsTArray<uint8_t> gfxWindowsPlatform::GetPlatformCMSOutputProfileData() { nsTArray<uint8_t> gfxWindowsPlatform::GetPlatformCMSOutputProfileData() {
if (XRE_IsContentProcess()) { if (XRE_IsContentProcess()) {
// This will be passed in during InitChild so we can avoid sending a auto& cmsOutputProfileData = GetCMSOutputProfileData();
// sync message back to the parent during init. // We should have set our profile data when we received our initial
const mozilla::gfx::ContentDeviceData* contentDeviceData = // ContentDeviceData.
GetInitContentDeviceData(); MOZ_ASSERT(cmsOutputProfileData.isSome(),
if (contentDeviceData) { "Should have created output profile data when we received "
MOZ_ASSERT(!contentDeviceData->cmsOutputProfileData().IsEmpty()); "initial content device data.");
return contentDeviceData->cmsOutputProfileData().Clone();
}
// Otherwise we need to ask the parent for the updated color profile // If we have data, it should not be empty.
mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton(); MOZ_ASSERT_IF(cmsOutputProfileData.isSome(),
nsTArray<uint8_t> result; !cmsOutputProfileData->IsEmpty());
Unused << cc->SendGetOutputColorProfileData(&result);
return result; if (cmsOutputProfileData.isSome()) {
return cmsOutputProfileData.ref().Clone();
}
return nsTArray<uint8_t>();
} }
return GetPlatformCMSOutputProfileData_Impl(); return GetPlatformCMSOutputProfileData_Impl();
@ -1784,9 +1785,6 @@ void gfxWindowsPlatform::ImportContentDeviceData(
DeviceManagerDx* dm = DeviceManagerDx::Get(); DeviceManagerDx* dm = DeviceManagerDx::Get();
dm->ImportDeviceInfo(aData.d3d11()); dm->ImportDeviceInfo(aData.d3d11());
} }
// aData->cmsOutputProfileData() will be read during color profile init,
// not as part of this import function
} }
void gfxWindowsPlatform::BuildContentDeviceData(ContentDeviceData* aOut) { void gfxWindowsPlatform::BuildContentDeviceData(ContentDeviceData* aOut) {

View file

@ -68,8 +68,6 @@ description = legacy sync IPC - please add detailed description
description = legacy sync IPC - please add detailed description description = legacy sync IPC - please add detailed description
[PContent::EndDriverCrashGuard] [PContent::EndDriverCrashGuard]
description = legacy sync IPC - please add detailed description description = legacy sync IPC - please add detailed description
[PContent::GetOutputColorProfileData]
description = Retrieve the contents of the output color profile file
[PContent::GetFontListShmBlock] [PContent::GetFontListShmBlock]
description = for bug 1514869 - layout code needs synchronous access to font list, but this is used only once per block, after which content directly reads the shared memory description = for bug 1514869 - layout code needs synchronous access to font list, but this is used only once per block, after which content directly reads the shared memory
[PContent::InitializeFamily] [PContent::InitializeFamily]