summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/renderer_main_platform_delegate_mac.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/chrome/renderer/renderer_main_platform_delegate_mac.cc b/chrome/renderer/renderer_main_platform_delegate_mac.cc
index c7e7619..bf61141 100644
--- a/chrome/renderer/renderer_main_platform_delegate_mac.cc
+++ b/chrome/renderer/renderer_main_platform_delegate_mac.cc
@@ -6,6 +6,7 @@
#include "base/debug_util.h"
+#include <ApplicationServices/ApplicationServices.h>
extern "C" {
#include <sandbox.h>
}
@@ -24,6 +25,20 @@ RendererMainPlatformDelegate::~RendererMainPlatformDelegate() {
void RendererMainPlatformDelegate::PlatformInitialize() {
// Load WebKit system interfaces.
InitWebCoreSystemInterface();
+
+ // Warmup CG - without these calls these two functions won't work in the
+ // sandbox.
+ CGColorSpaceRef rgb_colorspace =
+ CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
+
+ // Allocate a 1 byte image.
+ char data[8];
+ CGContextRef tmp = CGBitmapContextCreate(data, 1, 1, 8, 1*8,
+ rgb_colorspace,
+ kCGImageAlphaPremultipliedFirst |
+ kCGBitmapByteOrder32Host);
+ CGColorSpaceRelease(rgb_colorspace);
+ CGContextRelease(tmp);
}
void RendererMainPlatformDelegate::PlatformUninitialize() {