Commit f3198fb3 authored by rsesek's avatar rsesek Committed by Commit bot

[Mac] Shut down connections to WindowServer before engaging the sandbox.

The connection is only needed during sandbox warmup to initialize the default
color space. It was formerly needed by scrollbar NSAnimations, but that was
replaced via https://codereview.chromium.org/529103002/.

A similar CL was landed and reverted:
https://chromium.googlesource.com/chromium/src.git/+/53ffdf90f4646dbde8df72007fbdc97f3f0220de

BUG=397642, 306348
TEST=Manually tested on 10.6-10.10.

Review URL: https://codereview.chromium.org/561833006

Cr-Commit-Position: refs/heads/master@{#294382}
parent 0f4b476f
......@@ -38,6 +38,11 @@ extern "C" {
#include "ui/base/layout.h"
#include "ui/gl/gl_surface.h"
extern "C" {
void CGSSetDenyWindowServerConnections(bool);
void CGSShutdownServerConnections();
};
namespace content {
namespace {
......@@ -268,8 +273,8 @@ void Sandbox::SandboxWarmup(int sandbox_type) {
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
// Load in the color profiles we'll need (as a side effect).
(void) base::mac::GetSRGBColorSpace();
(void) base::mac::GetSystemColorSpace();
ignore_result(base::mac::GetSRGBColorSpace());
ignore_result(base::mac::GetSystemColorSpace());
// CGColorSpaceCreateSystemDefaultCMYK - 10.6
base::ScopedCFTypeRef<CGColorSpaceRef> cmyk_colorspace(
......@@ -325,6 +330,14 @@ void Sandbox::SandboxWarmup(int sandbox_type) {
NSColor* color = [NSColor controlTextColor];
[color colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
}
if (sandbox_type == SANDBOX_TYPE_RENDERER) {
// Now disconnect from WindowServer, after all objects have been warmed up.
// Shutting down the connection requires connecting to WindowServer,
// so do this before actually engaging the sandbox.
CGSSetDenyWindowServerConnections(true);
CGSShutdownServerConnections();
}
}
// static
......
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