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/common/gpu/client/command_buffer_proxy_impl.h" | 11 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
12 #include "content/common/gpu/client/gpu_channel_host.h" | 12 #include "content/common/gpu/client/gpu_channel_host.h" |
13 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
14 #include "content/public/common/web_preferences.h" | 14 #include "content/public/common/web_preferences.h" |
15 #include "content/renderer/pepper/host_globals.h" | 15 #include "content/renderer/pepper/host_globals.h" |
16 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 16 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 17 #include "content/renderer/pepper/pepper_plugin_instance_throttler.h" |
17 #include "content/renderer/pepper/plugin_module.h" | 18 #include "content/renderer/pepper/plugin_module.h" |
18 #include "content/renderer/render_thread_impl.h" | 19 #include "content/renderer/render_thread_impl.h" |
19 #include "content/renderer/render_view_impl.h" | 20 #include "content/renderer/render_view_impl.h" |
20 #include "gpu/command_buffer/client/gles2_implementation.h" | 21 #include "gpu/command_buffer/client/gles2_implementation.h" |
21 #include "ppapi/c/ppp_graphics_3d.h" | 22 #include "ppapi/c/ppp_graphics_3d.h" |
22 #include "ppapi/thunk/enter.h" | 23 #include "ppapi/thunk/enter.h" |
23 #include "third_party/WebKit/public/platform/WebString.h" | 24 #include "third_party/WebKit/public/platform/WebString.h" |
24 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 25 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
25 #include "third_party/WebKit/public/web/WebDocument.h" | 26 #include "third_party/WebKit/public/web/WebDocument.h" |
26 #include "third_party/WebKit/public/web/WebElement.h" | 27 #include "third_party/WebKit/public/web/WebElement.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 if (!plugin_instance) | 236 if (!plugin_instance) |
236 return false; | 237 return false; |
237 | 238 |
238 const WebPreferences& prefs = | 239 const WebPreferences& prefs = |
239 static_cast<RenderViewImpl*>(plugin_instance->GetRenderView()) | 240 static_cast<RenderViewImpl*>(plugin_instance->GetRenderView()) |
240 ->webkit_preferences(); | 241 ->webkit_preferences(); |
241 // 3D access might be disabled or blacklisted. | 242 // 3D access might be disabled or blacklisted. |
242 if (!prefs.pepper_3d_enabled) | 243 if (!prefs.pepper_3d_enabled) |
243 return false; | 244 return false; |
244 | 245 |
| 246 // Force SW rendering for keyframe extraction to avoid pixel reads from VRAM. |
| 247 PepperPluginInstanceThrottler* throttler = plugin_instance->throttler(); |
| 248 if (throttler && throttler->needs_representative_keyframe()) |
| 249 return false; |
| 250 |
245 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 251 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
246 if (!render_thread) | 252 if (!render_thread) |
247 return false; | 253 return false; |
248 | 254 |
249 channel_ = render_thread->EstablishGpuChannelSync( | 255 channel_ = render_thread->EstablishGpuChannelSync( |
250 CAUSE_FOR_GPU_LAUNCH_PEPPERPLATFORMCONTEXT3DIMPL_INITIALIZE); | 256 CAUSE_FOR_GPU_LAUNCH_PEPPERPLATFORMCONTEXT3DIMPL_INITIALIZE); |
251 if (!channel_.get()) | 257 if (!channel_.get()) |
252 return false; | 258 return false; |
253 | 259 |
254 gfx::Size surface_size; | 260 gfx::Size surface_size; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 instance->module()->GetPluginInterface(PPP_GRAPHICS_3D_INTERFACE)); | 379 instance->module()->GetPluginInterface(PPP_GRAPHICS_3D_INTERFACE)); |
374 // We have to check *again* that the instance exists, because it could have | 380 // We have to check *again* that the instance exists, because it could have |
375 // been deleted during GetPluginInterface(). Even the PluginModule could be | 381 // been deleted during GetPluginInterface(). Even the PluginModule could be |
376 // deleted, but in that case, the instance should also be gone, so the | 382 // deleted, but in that case, the instance should also be gone, so the |
377 // GetInstance check covers both cases. | 383 // GetInstance check covers both cases. |
378 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance)) | 384 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance)) |
379 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); | 385 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); |
380 } | 386 } |
381 | 387 |
382 } // namespace content | 388 } // namespace content |
OLD | NEW |