| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/renderer/renderer_main_platform_delegate.h" | 5 #include "chrome/renderer/renderer_main_platform_delegate.h" |
| 6 | 6 |
| 7 #include "base/debug_util.h" | 7 #include "base/debug_util.h" |
| 8 | 8 |
| 9 #import <Foundation/Foundation.h> | 9 #import <Foundation/Foundation.h> |
| 10 #import <ApplicationServices/ApplicationServices.h> | 10 #import <ApplicationServices/ApplicationServices.h> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // Warmup System APIs that empirically need to be accessed before the Sandbox | 31 // Warmup System APIs that empirically need to be accessed before the Sandbox |
| 32 // is turned on. | 32 // is turned on. |
| 33 // This method is layed out in blocks, each one containing a separate function | 33 // This method is layed out in blocks, each one containing a separate function |
| 34 // that needs to be warmed up. The OS version on which we found the need to | 34 // that needs to be warmed up. The OS version on which we found the need to |
| 35 // enable the function is also noted. | 35 // enable the function is also noted. |
| 36 // This function is tested on the following OS versions: | 36 // This function is tested on the following OS versions: |
| 37 // 10.5.6, 10.6 seed release | 37 // 10.5.6, 10.6 seed release |
| 38 void SandboxWarmup() { | 38 void SandboxWarmup() { |
| 39 base::ScopedNSAutoreleasePool scoped_pool; | 39 base::ScopedNSAutoreleasePool scoped_pool; |
| 40 | 40 |
| 41 { // CGColorSpaceCreateWithName(), CGBitmapContextCreate() - 10.5.6 | 41 { // CGColorSpaceCreateWithName(), CGBitmapContextCreate() - 10.5.6 |
| 42 CGColorSpaceRef rgb_colorspace = | 42 scoped_cftyperef<CGColorSpaceRef> rgb_colorspace( |
| 43 CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); | 43 CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); |
| 44 | 44 |
| 45 // Allocate a 1 byte image. | 45 // Allocate a 1x1 image. |
| 46 char data[8]; | 46 char data[4]; |
| 47 CGContextRef tmp = CGBitmapContextCreate(data, 1, 1, 8, 1*8, | 47 scoped_cftyperef<CGContextRef> context( |
| 48 rgb_colorspace, | 48 CGBitmapContextCreate(data, 1, 1, 8, 1 * 4, |
| 49 kCGImageAlphaPremultipliedFirst | | 49 rgb_colorspace, |
| 50 kCGBitmapByteOrder32Host); | 50 kCGImageAlphaPremultipliedFirst | |
| 51 kCGBitmapByteOrder32Host)); |
| 51 | 52 |
| 52 CGColorSpaceRelease(rgb_colorspace); | 53 // Load in the color profiles we'll need (as a side effect). |
| 53 CGContextRelease(tmp); | |
| 54 | |
| 55 // load in the color profiles we'll need (as a side effect). | |
| 56 (void) mac_util::GetSRGBColorSpace(); | 54 (void) mac_util::GetSRGBColorSpace(); |
| 57 (void) mac_util::GetSystemColorSpace(); | 55 (void) mac_util::GetSystemColorSpace(); |
| 56 |
| 57 // CGColorSpaceCreateSystemDefaultCMYK - 10.6 |
| 58 scoped_cftyperef<CGColorSpaceRef> cmyk_colorspace( |
| 59 CGColorSpaceCreateWithName(kCGColorSpaceGenericCMYK)); |
| 58 } | 60 } |
| 59 | 61 |
| 60 { // [-NSColor colorUsingColorSpaceName] - 10.5.6 | 62 { // [-NSColor colorUsingColorSpaceName] - 10.5.6 |
| 61 NSColor* color = [NSColor controlTextColor]; | 63 NSColor* color = [NSColor controlTextColor]; |
| 62 [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; | 64 [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; |
| 63 } | 65 } |
| 64 | 66 |
| 65 { // localtime() - 10.5.6 | 67 { // localtime() - 10.5.6 |
| 66 time_t tv = {0}; | 68 time_t tv = {0}; |
| 67 localtime(&tv); | 69 localtime(&tv); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 if (error == -1) { | 143 if (error == -1) { |
| 142 LOG(ERROR) << "Failed to Initialize Sandbox: " << error_buff; | 144 LOG(ERROR) << "Failed to Initialize Sandbox: " << error_buff; |
| 143 } | 145 } |
| 144 sandbox_free_error(error_buff); | 146 sandbox_free_error(error_buff); |
| 145 return success; | 147 return success; |
| 146 } | 148 } |
| 147 | 149 |
| 148 void RendererMainPlatformDelegate::RunSandboxTests() { | 150 void RendererMainPlatformDelegate::RunSandboxTests() { |
| 149 // TODO(port): Run sandbox unit test here. | 151 // TODO(port): Run sandbox unit test here. |
| 150 } | 152 } |
| OLD | NEW |