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/renderer/pepper/ppb_graphics_3d_impl.h" | 5 #include "content/renderer/pepper/ppb_graphics_3d_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 HostGlobals::Get()->GetInstance(pp_instance()); | 205 HostGlobals::Get()->GetInstance(pp_instance()); |
206 if (!plugin_instance) | 206 if (!plugin_instance) |
207 return false; | 207 return false; |
208 | 208 |
209 const WebPreferences& prefs = | 209 const WebPreferences& prefs = |
210 static_cast<RenderViewImpl*>(plugin_instance->GetRenderView()) | 210 static_cast<RenderViewImpl*>(plugin_instance->GetRenderView()) |
211 ->webkit_preferences(); | 211 ->webkit_preferences(); |
212 // 3D access might be disabled or blacklisted. | 212 // 3D access might be disabled or blacklisted. |
213 if (!prefs.pepper_3d_enabled) | 213 if (!prefs.pepper_3d_enabled) |
214 return false; | 214 return false; |
215 // If accelerated compositing of plugins is disabled, fail to create a 3D | |
216 // context, because it won't be visible. This allows graceful fallback in the | |
217 // modules. | |
218 if (!prefs.accelerated_compositing_for_plugins_enabled) | |
219 return false; | |
220 | 215 |
221 platform_context_.reset(new PlatformContext3D); | 216 platform_context_.reset(new PlatformContext3D); |
222 if (!platform_context_) | 217 if (!platform_context_) |
223 return false; | 218 return false; |
224 | 219 |
225 PlatformContext3D* share_platform_context = NULL; | 220 PlatformContext3D* share_platform_context = NULL; |
226 if (share_context) { | 221 if (share_context) { |
227 PPB_Graphics3D_Impl* share_graphics = | 222 PPB_Graphics3D_Impl* share_graphics = |
228 static_cast<PPB_Graphics3D_Impl*>(share_context); | 223 static_cast<PPB_Graphics3D_Impl*>(share_context); |
229 share_platform_context = share_graphics->platform_context(); | 224 share_platform_context = share_graphics->platform_context(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 instance->module()->GetPluginInterface(PPP_GRAPHICS_3D_INTERFACE)); | 293 instance->module()->GetPluginInterface(PPP_GRAPHICS_3D_INTERFACE)); |
299 // We have to check *again* that the instance exists, because it could have | 294 // We have to check *again* that the instance exists, because it could have |
300 // been deleted during GetPluginInterface(). Even the PluginModule could be | 295 // been deleted during GetPluginInterface(). Even the PluginModule could be |
301 // deleted, but in that case, the instance should also be gone, so the | 296 // deleted, but in that case, the instance should also be gone, so the |
302 // GetInstance check covers both cases. | 297 // GetInstance check covers both cases. |
303 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance)) | 298 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance)) |
304 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); | 299 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); |
305 } | 300 } |
306 | 301 |
307 } // namespace content | 302 } // namespace content |
OLD | NEW |