diff options
4 files changed, 20 insertions, 6 deletions
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index dd6a3c3..224b17c 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -102,11 +102,13 @@ const int kPluginsRefreshThresholdInSeconds = 3; // usage only once and send it as a response for both queries. static const int64 kCPUUsageSampleIntervalMs = 900; +#if defined(OS_WIN) // On Windows, |g_color_profile| can run on an arbitrary background thread. // We avoid races by using LazyInstance's constructor lock to initialize the // object. base::LazyInstance<gfx::ColorProfile>::Leaky g_color_profile = LAZY_INSTANCE_INITIALIZER; +#endif // Common functionality for converting a sync renderer message to a callback // function in the browser. Derive from this, create it on the heap when @@ -432,8 +434,10 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message, IPC_MESSAGE_HANDLER(ViewHostMsg_GetCPUUsage, OnGetCPUUsage) IPC_MESSAGE_HANDLER(ViewHostMsg_GetAudioHardwareConfig, OnGetAudioHardwareConfig) +#if defined(OS_WIN) IPC_MESSAGE_HANDLER(ViewHostMsg_GetMonitorColorProfile, OnGetMonitorColorProfile) +#endif IPC_MESSAGE_HANDLER(ViewHostMsg_MediaLogEvents, OnMediaLogEvents) IPC_MESSAGE_HANDLER(ViewHostMsg_Are3DAPIsBlocked, OnAre3DAPIsBlocked) IPC_MESSAGE_HANDLER(ViewHostMsg_DidLose3DContext, OnDidLose3DContext) @@ -852,14 +856,14 @@ void RenderMessageFilter::OnGetAudioHardwareConfig( media::AudioManagerBase::kDefaultDeviceId); } -void RenderMessageFilter::OnGetMonitorColorProfile(std::vector<char>* profile) { #if defined(OS_WIN) +void RenderMessageFilter::OnGetMonitorColorProfile(std::vector<char>* profile) { DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); if (BackingStoreWin::ColorManagementEnabled()) return; -#endif *profile = g_color_profile.Get().profile(); } +#endif void RenderMessageFilter::OnDownloadUrl(const IPC::Message& message, const GURL& url, diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h index ce135d9..b7ea390 100644 --- a/content/browser/renderer_host/render_message_filter.h +++ b/content/browser/renderer_host/render_message_filter.h @@ -200,8 +200,10 @@ class RenderMessageFilter : public BrowserMessageFilter { void OnGetAudioHardwareConfig(media::AudioParameters* input_params, media::AudioParameters* output_params); +#if defined(OS_WIN) // Used to look up the monitor color profile. void OnGetMonitorColorProfile(std::vector<char>* profile); +#endif // Used to ask the browser to allocate a block of shared memory for the // renderer to send back data in, since shared memory can't be created diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 0eff2fd..1c5a8a9 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -1441,10 +1441,6 @@ IPC_SYNC_MESSAGE_CONTROL0_2(ViewHostMsg_GetAudioHardwareConfig, IPC_SYNC_MESSAGE_CONTROL0_1(ViewHostMsg_GetCPUUsage, int /* CPU usage in percents */) -// Asks the browser for the user's monitor profile. -IPC_SYNC_MESSAGE_CONTROL0_1(ViewHostMsg_GetMonitorColorProfile, - std::vector<char> /* profile */) - // Asks the browser for the renderer process memory size stats. IPC_SYNC_MESSAGE_CONTROL0_2(ViewHostMsg_GetProcessMemorySizes, size_t /* private_bytes */, @@ -1733,6 +1729,10 @@ IPC_MESSAGE_ROUTED1(ViewHostMsg_WindowlessPluginDummyWindowCreated, IPC_MESSAGE_ROUTED1(ViewHostMsg_WindowlessPluginDummyWindowDestroyed, gfx::NativeViewId /* dummy_activation_window */) + +// Asks the browser for the user's monitor profile. +IPC_SYNC_MESSAGE_CONTROL0_1(ViewHostMsg_GetMonitorColorProfile, + std::vector<char> /* profile */) #endif // Get the list of proxies to use for |url|, as a semicolon delimited list diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index 60c914a..79cc75a 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -68,6 +68,7 @@ #include "third_party/WebKit/public/platform/WebVector.h" #include "third_party/WebKit/public/web/WebFrame.h" #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" +#include "ui/gfx/color_profile.h" #include "url/gurl.h" #include "webkit/common/gpu/webgraphicscontext3d_provider_impl.h" #include "webkit/common/quota/quota_types.h" @@ -828,10 +829,17 @@ RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString( void RendererWebKitPlatformSupportImpl::screenColorProfile( WebVector<char>* to_profile) { +#if defined(OS_WIN) + // On Windows screen color profile is only available in the browser. std::vector<char> profile; RenderThread::Get()->Send( new ViewHostMsg_GetMonitorColorProfile(&profile)); *to_profile = profile; +#else + // On other platforms color profile can be obtained directly. + gfx::ColorProfile profile; + *to_profile = profile.profile(); +#endif } //------------------------------------------------------------------------------ |