Commit 77adfc5b authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Move the SetRenderingColorSpace into blink.

We need to call into the gpu factories and assign the rendering color
space so the easiest way to do that is add a new method to the platform
object.

BUG=1097816

Change-Id: I68e5c279b3b9d923a2e77af050b92e74c578230d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2316825
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#793630}
parent 16fe8fef
...@@ -464,21 +464,6 @@ void RenderWidget::OnClose() { ...@@ -464,21 +464,6 @@ void RenderWidget::OnClose() {
void RenderWidget::UpdateVisualProperties( void RenderWidget::UpdateVisualProperties(
const blink::VisualProperties& visual_properties) { const blink::VisualProperties& visual_properties) {
// Inform the rendering thread of the color space indicating the presence of
// HDR capabilities. The HDR bit happens to be globally true/false for all
// browser windows (on Windows OS) and thus would be the same for all
// RenderWidgets, so clobbering each other works out since only the HDR bit is
// used. See https://crbug.com/803451 and
// https://chromium-review.googlesource.com/c/chromium/src/+/852912/15#message-68bbd3e25c3b421a79cd028b2533629527d21fee
//
// The RenderThreadImpl can be null in tests.
{
RenderThreadImpl* render_thread = RenderThreadImpl::current();
if (render_thread)
render_thread->SetRenderingColorSpace(
visual_properties.screen_info.color_space);
}
if (delegate()) { if (delegate()) {
if (size_ != visual_properties.new_size) { if (size_ != visual_properties.new_size) {
// Only hide popups when the size changes. Eg https://crbug.com/761908. // Only hide popups when the size changes. Eg https://crbug.com/761908.
......
...@@ -904,6 +904,15 @@ RendererBlinkPlatformImpl::GetGpuFactories() { ...@@ -904,6 +904,15 @@ RendererBlinkPlatformImpl::GetGpuFactories() {
return render_thread->GetGpuFactories(); return render_thread->GetGpuFactories();
} }
void RendererBlinkPlatformImpl::SetRenderingColorSpace(
const gfx::ColorSpace& color_space) {
auto* render_thread = RenderThreadImpl::current();
if (!render_thread)
return;
render_thread->SetRenderingColorSpace(color_space);
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
blink::mojom::CodeCacheHost& RendererBlinkPlatformImpl::GetCodeCacheHost() { blink::mojom::CodeCacheHost& RendererBlinkPlatformImpl::GetCodeCacheHost() {
......
...@@ -208,6 +208,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { ...@@ -208,6 +208,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
scoped_refptr<network::SharedURLLoaderFactory> factory) override; scoped_refptr<network::SharedURLLoaderFactory> factory) override;
media::GpuVideoAcceleratorFactories* GetGpuFactories() override; media::GpuVideoAcceleratorFactories* GetGpuFactories() override;
void SetRenderingColorSpace(const gfx::ColorSpace& color_space) override;
// Tells this platform that the renderer is locked to a site (i.e., a scheme // Tells this platform that the renderer is locked to a site (i.e., a scheme
// plus eTLD+1, such as https://google.com), or to a more specific origin. // plus eTLD+1, such as https://google.com), or to a more specific origin.
......
...@@ -72,6 +72,10 @@ namespace base { ...@@ -72,6 +72,10 @@ namespace base {
class SingleThreadTaskRunner; class SingleThreadTaskRunner;
} }
namespace gfx {
class ColorSpace;
}
namespace gpu { namespace gpu {
class GpuMemoryBufferManager; class GpuMemoryBufferManager;
} }
...@@ -679,6 +683,8 @@ class BLINK_PLATFORM_EXPORT Platform { ...@@ -679,6 +683,8 @@ class BLINK_PLATFORM_EXPORT Platform {
return nullptr; return nullptr;
} }
virtual void SetRenderingColorSpace(const gfx::ColorSpace& color_space) {}
// Renderer Memory Metrics ---------------------------------------------- // Renderer Memory Metrics ----------------------------------------------
virtual void RecordMetricsForBackgroundedRendererPurge() {} virtual void RecordMetricsForBackgroundedRendererPurge() {}
......
...@@ -295,6 +295,15 @@ void WidgetBase::UpdateVisualProperties( ...@@ -295,6 +295,15 @@ void WidgetBase::UpdateVisualProperties(
visual_properties.screen_info.device_scale_factor)); visual_properties.screen_info.device_scale_factor));
} }
// Inform the rendering thread of the color space indicating the presence of
// HDR capabilities. The HDR bit happens to be globally true/false for all
// browser windows (on Windows OS) and thus would be the same for all
// RenderWidgets, so clobbering each other works out since only the HDR bit is
// used. See https://crbug.com/803451 and
// https://chromium-review.googlesource.com/c/chromium/src/+/852912/15#message-68bbd3e25c3b421a79cd028b2533629527d21fee
Platform::Current()->SetRenderingColorSpace(
visual_properties.screen_info.color_space);
LayerTreeHost()->SetBrowserControlsParams( LayerTreeHost()->SetBrowserControlsParams(
visual_properties.browser_controls_params); visual_properties.browser_controls_params);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment