| 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" |
| 11 #include "content/public/common/content_switches.h" |
| 11 #include "content/renderer/pepper/host_globals.h" | 12 #include "content/renderer/pepper/host_globals.h" |
| 12 #include "content/renderer/pepper/pepper_platform_context_3d.h" | 13 #include "content/renderer/pepper/pepper_platform_context_3d.h" |
| 13 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 14 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 14 #include "content/renderer/pepper/plugin_module.h" | 15 #include "content/renderer/pepper/plugin_module.h" |
| 15 #include "content/renderer/render_view_impl.h" | 16 #include "content/renderer/render_view_impl.h" |
| 16 #include "gpu/command_buffer/client/gles2_implementation.h" | 17 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 17 #include "ppapi/c/ppp_graphics_3d.h" | 18 #include "ppapi/c/ppp_graphics_3d.h" |
| 18 #include "ppapi/thunk/enter.h" | 19 #include "ppapi/thunk/enter.h" |
| 19 #include "third_party/WebKit/public/platform/WebString.h" | 20 #include "third_party/WebKit/public/platform/WebString.h" |
| 20 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 21 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
| 21 #include "third_party/WebKit/public/web/WebDocument.h" | 22 #include "third_party/WebKit/public/web/WebDocument.h" |
| 22 #include "third_party/WebKit/public/web/WebElement.h" | 23 #include "third_party/WebKit/public/web/WebElement.h" |
| 23 #include "third_party/WebKit/public/web/WebFrame.h" | 24 #include "third_party/WebKit/public/web/WebFrame.h" |
| 24 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 25 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 25 #include "webkit/common/webpreferences.h" | 26 #include "webkit/common/webpreferences.h" |
| 26 #include "webkit/plugins/plugin_switches.h" | |
| 27 | 27 |
| 28 using ppapi::thunk::EnterResourceNoLock; | 28 using ppapi::thunk::EnterResourceNoLock; |
| 29 using ppapi::thunk::PPB_Graphics3D_API; | 29 using ppapi::thunk::PPB_Graphics3D_API; |
| 30 using WebKit::WebConsoleMessage; | 30 using WebKit::WebConsoleMessage; |
| 31 using WebKit::WebFrame; | 31 using WebKit::WebFrame; |
| 32 using WebKit::WebPluginContainer; | 32 using WebKit::WebPluginContainer; |
| 33 using WebKit::WebString; | 33 using WebKit::WebString; |
| 34 | 34 |
| 35 namespace content { | 35 namespace content { |
| 36 | 36 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() { | 67 PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() { |
| 68 DestroyGLES2Impl(); | 68 DestroyGLES2Impl(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 // static | 71 // static |
| 72 PP_Bool PPB_Graphics3D_Impl::IsGpuBlacklisted() { | 72 PP_Bool PPB_Graphics3D_Impl::IsGpuBlacklisted() { |
| 73 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 73 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 74 if (command_line) | 74 if (command_line) |
| 75 return PP_FromBool( | 75 return PP_FromBool(command_line->HasSwitch(switches::kDisablePepper3d)); |
| 76 command_line->HasSwitch(switches::kDisablePepper3d)); | |
| 77 return PP_TRUE; | 76 return PP_TRUE; |
| 78 } | 77 } |
| 79 | 78 |
| 80 // static | 79 // static |
| 81 PP_Resource PPB_Graphics3D_Impl::Create(PP_Instance instance, | 80 PP_Resource PPB_Graphics3D_Impl::Create(PP_Instance instance, |
| 82 PP_Resource share_context, | 81 PP_Resource share_context, |
| 83 const int32_t* attrib_list) { | 82 const int32_t* attrib_list) { |
| 84 PPB_Graphics3D_API* share_api = NULL; | 83 PPB_Graphics3D_API* share_api = NULL; |
| 85 if (IsGpuBlacklisted()) | 84 if (IsGpuBlacklisted()) |
| 86 return 0; | 85 return 0; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 PP_Instance this_pp_instance = pp_instance(); | 331 PP_Instance this_pp_instance = pp_instance(); |
| 333 const PPP_Graphics3D* ppp_graphics_3d = | 332 const PPP_Graphics3D* ppp_graphics_3d = |
| 334 static_cast<const PPP_Graphics3D*>( | 333 static_cast<const PPP_Graphics3D*>( |
| 335 instance->module()->GetPluginInterface( | 334 instance->module()->GetPluginInterface( |
| 336 PPP_GRAPHICS_3D_INTERFACE)); | 335 PPP_GRAPHICS_3D_INTERFACE)); |
| 337 if (ppp_graphics_3d) | 336 if (ppp_graphics_3d) |
| 338 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); | 337 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); |
| 339 } | 338 } |
| 340 | 339 |
| 341 } // namespace content | 340 } // namespace content |
| OLD | NEW |