Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: content/common/sandbox_mac.mm

Issue 673443002: [Mac] Shut down connections to WindowServer before engaging the sandbox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_mac.mm
diff --git a/content/common/sandbox_mac.mm b/content/common/sandbox_mac.mm
index 9ef3e1c6cdcad0f1c44e32102d7912bef2a1225e..118919f20a3491f284216ff8d945b7889bf4b665 100644
--- a/content/common/sandbox_mac.mm
+++ b/content/common/sandbox_mac.mm
@@ -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,18 @@ void Sandbox::SandboxWarmup(int sandbox_type) {
NSColor* color = [NSColor controlTextColor];
[color colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
}
+
+ if (sandbox_type == SANDBOX_TYPE_RENDERER &&
+ base::mac::IsOSMountainLionOrLater()) {
+ // 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. This is only done on
+ // 10.8 and higher because doing it on earlier OSes causes layout tests to
+ // fail <http://crbug.com/397642#c48>. This may cause two log messages to
+ // be printed to the system logger on certain OS versions.
+ CGSSetDenyWindowServerConnections(true);
+ CGSShutdownServerConnections();
+ }
}
// static
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698