diff options
author | maf@google.com <maf@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-10 22:40:10 +0000 |
---|---|---|
committer | maf@google.com <maf@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-10 22:40:10 +0000 |
commit | b6cd54c015d08ae0dac490ecd04ff8be49a8ac80 (patch) | |
tree | 511d18ce2299b7b025110e558326af31fb90c5d1 /o3d | |
parent | 96c28e2daf1d2029ec057140ef340e869f0305d7 (diff) | |
download | chromium_src-b6cd54c015d08ae0dac490ecd04ff8be49a8ac80.zip chromium_src-b6cd54c015d08ae0dac490ecd04ff8be49a8ac80.tar.gz chromium_src-b6cd54c015d08ae0dac490ecd04ff8be49a8ac80.tar.bz2 |
Add an Info.plist flag to force the software renderer.
Review URL: http://codereview.chromium.org/199087
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25937 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/plugin/mac/Info.plist | 2 | ||||
-rw-r--r-- | o3d/plugin/mac/config_mac.mm | 58 |
2 files changed, 44 insertions, 16 deletions
diff --git a/o3d/plugin/mac/Info.plist b/o3d/plugin/mac/Info.plist index 5d0a28e..c772f77 100644 --- a/o3d/plugin/mac/Info.plist +++ b/o3d/plugin/mac/Info.plist @@ -38,6 +38,8 @@ </dict> <key>WebPluginName</key> <string>@@@PluginName@@@</string> + <key>O3DForceSoftwareRenderer</key> + <false/> <key>BreakpadProduct</key> <string>O3D</string> diff --git a/o3d/plugin/mac/config_mac.mm b/o3d/plugin/mac/config_mac.mm index eb995298..c85f8c8 100644 --- a/o3d/plugin/mac/config_mac.mm +++ b/o3d/plugin/mac/config_mac.mm @@ -46,6 +46,20 @@ #include "plugin/cross/plugin_metrics.h" #include "plugin_mac.h" +@interface BundleReader : NSObject { +} + +- (BOOL)boolValueForKey:(NSString*)key; +@end + +@implementation BundleReader + +- (BOOL) boolValueForKey:(NSString*)key { + NSBundle *bundle = [NSBundle bundleForClass:[self class]]; + return [[bundle objectForInfoDictionaryKey:key] boolValue]; +} +@end + namespace o3d { // Trivial little functions to check for the OS version boundaries we care about @@ -161,27 +175,39 @@ GPUInfo softwareRenderList[] = { {0x8086, 0x2a02}, // Intel GMA X3100 Macbook {0x8086, 0x27a2} // Intel GMA 950 Mac Mini }; - + +static bool BundleFlagForcesSoftwareRenderer() { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + BundleReader *bundle = [[[BundleReader alloc] init] autorelease]; + BOOL result = [bundle boolValueForKey:@"O3DForceSoftwareRenderer"]; + [pool release]; + return result != NO; +} + bool UseSoftwareRenderer() { static bool use_software_renderer = false; static bool is_initialized = false; if (!is_initialized) { - int vendorID; - int deviceID; - GetVideoCardInfo(kCGDirectMainDisplay, - &vendorID, - &deviceID, - NULL); - - use_software_renderer = false; - int list_count = arraysize(softwareRenderList); - for (int i = 0; i < list_count; ++i) { - GPUInfo &softwareRenderInfo = softwareRenderList[i]; - if (vendorID == softwareRenderInfo.vendorID - && deviceID == softwareRenderInfo.deviceID) { - use_software_renderer = true; - break; + if (BundleFlagForcesSoftwareRenderer()) { + use_software_renderer = true; + } else { + int vendorID; + int deviceID; + GetVideoCardInfo(kCGDirectMainDisplay, + &vendorID, + &deviceID, + NULL); + + use_software_renderer = false; + int list_count = arraysize(softwareRenderList); + for (int i = 0; i < list_count; ++i) { + GPUInfo &softwareRenderInfo = softwareRenderList[i]; + if (vendorID == softwareRenderInfo.vendorID + && deviceID == softwareRenderInfo.deviceID) { + use_software_renderer = true; + break; + } } } is_initialized = true; |