summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-13 17:08:03 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-13 17:08:03 +0000
commit927b5f60bdfdae856bc01d0cf56aa57d6f2fe5b4 (patch)
tree448c9a7656c5e9433b1e1d5697c2592aea055171 /chrome/renderer
parent20c74302b227db28d64ca8394be25f00b4f06fa2 (diff)
downloadchromium_src-927b5f60bdfdae856bc01d0cf56aa57d6f2fe5b4.zip
chromium_src-927b5f60bdfdae856bc01d0cf56aa57d6f2fe5b4.tar.gz
chromium_src-927b5f60bdfdae856bc01d0cf56aa57d6f2fe5b4.tar.bz2
Hack to get CG functions working in the OS X sandbox.
Review URL: http://codereview.chromium.org/21324 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9758 0039d316-1c4b-4281-b951-d872f2087c98
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() {