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

Side by Side Diff: content/plugin/webplugin_accelerated_surface_proxy_mac.cc

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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import <OpenGL/OpenGL.h> 5 #import <OpenGL/OpenGL.h>
6 6
7 #include "content/plugin/webplugin_accelerated_surface_proxy_mac.h" 7 #include "content/plugin/webplugin_accelerated_surface_proxy_mac.h"
8 8
9 #include "base/callback_old.h" 9 #include "base/callback_old.h"
10 #include "content/plugin/webplugin_proxy.h" 10 #include "content/plugin/webplugin_proxy.h"
11 #include "ui/gfx/surface/accelerated_surface_mac.h" 11 #include "ui/gfx/surface/accelerated_surface_mac.h"
12 #include "ui/gfx/surface/transport_dib.h" 12 #include "ui/gfx/surface/transport_dib.h"
13 13
14 WebPluginAcceleratedSurfaceProxy::WebPluginAcceleratedSurfaceProxy( 14 WebPluginAcceleratedSurfaceProxy::WebPluginAcceleratedSurfaceProxy(
15 WebPluginProxy* plugin_proxy) 15 WebPluginProxy* plugin_proxy,
16 gfx::GpuPreference gpu_preference)
16 : plugin_proxy_(plugin_proxy), 17 : plugin_proxy_(plugin_proxy),
17 window_handle_(NULL) { 18 window_handle_(NULL) {
18 surface_ = new AcceleratedSurface; 19 surface_ = new AcceleratedSurface;
19 // It's possible for OpenGL to fail to initialze (e.g., if an incompatible 20 // It's possible for OpenGL to fail to initialze (e.g., if an incompatible
20 // mode is forced via flags), so handle that gracefully. 21 // mode is forced via flags), so handle that gracefully.
21 if (!surface_->Initialize(NULL, true)) { 22 if (!surface_->Initialize(NULL, true, gpu_preference)) {
22 delete surface_; 23 delete surface_;
23 surface_ = NULL; 24 surface_ = NULL;
24 return; 25 return;
25 } 26 }
26 27
27 // Only used for 10.5 support, but harmless on 10.6+. 28 // Only used for 10.5 support, but harmless on 10.6+.
28 surface_->SetTransportDIBAllocAndFree( 29 surface_->SetTransportDIBAllocAndFree(
29 NewCallback(plugin_proxy_, &WebPluginProxy::AllocSurfaceDIB), 30 NewCallback(plugin_proxy_, &WebPluginProxy::AllocSurfaceDIB),
30 NewCallback(plugin_proxy_, &WebPluginProxy::FreeSurfaceDIB)); 31 NewCallback(plugin_proxy_, &WebPluginProxy::FreeSurfaceDIB));
31 } 32 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 72 }
72 73
73 void WebPluginAcceleratedSurfaceProxy::EndDrawing() { 74 void WebPluginAcceleratedSurfaceProxy::EndDrawing() {
74 if (!surface_) 75 if (!surface_)
75 return; 76 return;
76 77
77 surface_->SwapBuffers(); 78 surface_->SwapBuffers();
78 plugin_proxy_->AcceleratedFrameBuffersDidSwap( 79 plugin_proxy_->AcceleratedFrameBuffersDidSwap(
79 window_handle_, surface_->GetSurfaceId()); 80 window_handle_, surface_->GetSurfaceId());
80 } 81 }
OLDNEW
« no previous file with comments | « content/plugin/webplugin_accelerated_surface_proxy_mac.h ('k') | content/plugin/webplugin_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698