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

Unified Diff: content/browser/renderer_host/accelerated_plugin_view_mac.mm

Issue 8233027: Support dynamic switching between integrated and discrete GPUs on Mac OS X. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | « chrome/app/helper-Info.plist ('k') | content/common/gpu/gpu_channel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/accelerated_plugin_view_mac.mm
===================================================================
--- content/browser/renderer_host/accelerated_plugin_view_mac.mm (revision 105357)
+++ content/browser/renderer_host/accelerated_plugin_view_mac.mm (working copy)
@@ -4,10 +4,13 @@
#import "content/browser/renderer_host/accelerated_plugin_view_mac.h"
+#include <vector>
+
#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/render_widget_host_view_mac.h"
+#include "ui/gfx/gl/gl_context.h"
#include "ui/gfx/gl/gl_switches.h"
#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
@@ -35,14 +38,18 @@
[self setAutoresizingMask:NSViewMaxXMargin|NSViewMinYMargin];
- NSOpenGLPixelFormatAttribute attributes[] =
- { NSOpenGLPFAAccelerated, NSOpenGLPFADoubleBuffer, 0};
+ std::vector<NSOpenGLPixelFormatAttribute> attributes;
+ attributes.push_back(NSOpenGLPFAAccelerated);
+ attributes.push_back(NSOpenGLPFADoubleBuffer);
+ if (gfx::GLContext::SupportsDualGpus())
+ attributes.push_back(NSOpenGLPFAAllowOfflineRenderers);
+ attributes.push_back(0);
// TODO(zmo): remove the diagnostic error messages once we figure out the
// cause of the failure and a fix.
glPixelFormat_.reset([[NSOpenGLPixelFormat alloc]
- initWithAttributes:attributes]);
+ initWithAttributes:&attributes.front()]);
if (!glPixelFormat_)
LOG(ERROR) << "NSOpenGLPixelFormat initWithAttributes failed";
« no previous file with comments | « chrome/app/helper-Info.plist ('k') | content/common/gpu/gpu_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698