OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/child/npapi/webplugin_delegate_impl.h" | 5 #include "content/child/npapi/webplugin_delegate_impl.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 #import <QuartzCore/QuartzCore.h> | 8 #import <QuartzCore/QuartzCore.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; | 223 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; |
224 // On dual GPU systems, force the use of the discrete GPU for | 224 // On dual GPU systems, force the use of the discrete GPU for |
225 // the CARenderer underlying our Core Animation backend for | 225 // the CARenderer underlying our Core Animation backend for |
226 // all plugins except Flash. For some reason Unity3D's output | 226 // all plugins except Flash. For some reason Unity3D's output |
227 // doesn't show up if the integrated GPU is used. Safari keeps | 227 // doesn't show up if the integrated GPU is used. Safari keeps |
228 // even Flash 11 with Stage3D on the integrated GPU, so mirror | 228 // even Flash 11 with Stage3D on the integrated GPU, so mirror |
229 // that behavior here. | 229 // that behavior here. |
230 const WebPluginInfo& plugin_info = | 230 const WebPluginInfo& plugin_info = |
231 instance_->plugin_lib()->plugin_info(); | 231 instance_->plugin_lib()->plugin_info(); |
232 if (plugin_info.name.find(ASCIIToUTF16("Flash")) != | 232 if (plugin_info.name.find(base::ASCIIToUTF16("Flash")) != |
233 base::string16::npos) | 233 base::string16::npos) |
234 gpu_preference = gfx::PreferIntegratedGpu; | 234 gpu_preference = gfx::PreferIntegratedGpu; |
235 surface_ = plugin_->GetAcceleratedSurface(gpu_preference); | 235 surface_ = plugin_->GetAcceleratedSurface(gpu_preference); |
236 | 236 |
237 // If surface initialization fails for some reason, just continue | 237 // If surface initialization fails for some reason, just continue |
238 // without any drawing; returning false would be a more confusing user | 238 // without any drawing; returning false would be a more confusing user |
239 // experience (since it triggers a missing plugin placeholder). | 239 // experience (since it triggers a missing plugin placeholder). |
240 if (surface_ && surface_->context()) { | 240 if (surface_ && surface_->context()) { |
241 renderer_ = [[CARenderer rendererWithCGLContext:surface_->context() | 241 renderer_ = [[CARenderer rendererWithCGLContext:surface_->context() |
242 options:NULL] retain]; | 242 options:NULL] retain]; |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 window_rect_.width(), window_rect_.height())]; | 719 window_rect_.width(), window_rect_.height())]; |
720 [CATransaction commit]; | 720 [CATransaction commit]; |
721 | 721 |
722 [renderer_ setBounds:[layer_ bounds]]; | 722 [renderer_ setBounds:[layer_ bounds]]; |
723 surface_->SetSize(window_rect_.size()); | 723 surface_->SetSize(window_rect_.size()); |
724 // Kick off the drawing timer, if necessary. | 724 // Kick off the drawing timer, if necessary. |
725 PluginVisibilityChanged(); | 725 PluginVisibilityChanged(); |
726 } | 726 } |
727 | 727 |
728 } // namespace content | 728 } // namespace content |
OLD | NEW |