| 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/plugin_module.h" | 5 #include "content/renderer/pepper/plugin_module.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/message_loop/message_loop_proxy.h" | 14 #include "base/message_loop/message_loop_proxy.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "content/common/view_messages.h" | 17 #include "content/common/view_messages.h" |
| 18 #include "content/public/renderer/content_renderer_client.h" | 18 #include "content/public/renderer/content_renderer_client.h" |
| 19 #include "content/renderer/pepper/host_dispatcher_wrapper.h" | 19 #include "content/renderer/pepper/host_dispatcher_wrapper.h" |
| 20 #include "content/renderer/pepper/host_globals.h" | 20 #include "content/renderer/pepper/host_globals.h" |
| 21 #include "content/renderer/pepper/pepper_hung_plugin_filter.h" | 21 #include "content/renderer/pepper/pepper_hung_plugin_filter.h" |
| 22 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 22 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 23 #include "content/renderer/pepper/pepper_plugin_registry.h" | 23 #include "content/renderer/pepper/pepper_plugin_registry.h" |
| 24 #include "content/renderer/pepper/plugin_instance_throttler_impl.h" |
| 24 #include "content/renderer/pepper/ppapi_preferences_builder.h" | 25 #include "content/renderer/pepper/ppapi_preferences_builder.h" |
| 25 #include "content/renderer/pepper/ppb_image_data_impl.h" | 26 #include "content/renderer/pepper/ppb_image_data_impl.h" |
| 26 #include "content/renderer/pepper/ppb_proxy_impl.h" | 27 #include "content/renderer/pepper/ppb_proxy_impl.h" |
| 27 #include "content/renderer/pepper/ppb_scrollbar_impl.h" | 28 #include "content/renderer/pepper/ppb_scrollbar_impl.h" |
| 28 #include "content/renderer/pepper/ppb_var_deprecated_impl.h" | 29 #include "content/renderer/pepper/ppb_var_deprecated_impl.h" |
| 29 #include "content/renderer/pepper/ppb_video_decoder_impl.h" | 30 #include "content/renderer/pepper/ppb_video_decoder_impl.h" |
| 30 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 31 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
| 31 #include "content/renderer/render_view_impl.h" | 32 #include "content/renderer/render_view_impl.h" |
| 32 #include "ppapi/c/dev/ppb_audio_input_dev.h" | 33 #include "ppapi/c/dev/ppb_audio_input_dev.h" |
| 33 #include "ppapi/c/dev/ppb_buffer_dev.h" | 34 #include "ppapi/c/dev/ppb_buffer_dev.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 base::MessageLoop::current()->QuitNow(); | 239 base::MessageLoop::current()->QuitNow(); |
| 239 } | 240 } |
| 240 | 241 |
| 241 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) { | 242 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) { |
| 242 return HostGlobals::Get()->GetResourceTracker()->GetLiveObjectsForInstance( | 243 return HostGlobals::Get()->GetResourceTracker()->GetLiveObjectsForInstance( |
| 243 instance_id); | 244 instance_id); |
| 244 } | 245 } |
| 245 | 246 |
| 246 PP_Bool IsOutOfProcess() { return PP_FALSE; } | 247 PP_Bool IsOutOfProcess() { return PP_FALSE; } |
| 247 | 248 |
| 249 PP_Bool IsPeripheral(PP_Instance instance_id) { |
| 250 PepperPluginInstanceImpl* plugin_instance = |
| 251 host_globals->GetInstance(instance_id); |
| 252 if (!plugin_instance || !plugin_instance->throttler()) |
| 253 return PP_FALSE; |
| 254 return PP_FromBool(plugin_instance->throttler()->power_saver_enabled()); |
| 255 } |
| 256 |
| 248 void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) { | 257 void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) { |
| 249 PepperPluginInstanceImpl* plugin_instance = | 258 PepperPluginInstanceImpl* plugin_instance = |
| 250 host_globals->GetInstance(instance); | 259 host_globals->GetInstance(instance); |
| 251 if (!plugin_instance) | 260 if (!plugin_instance) |
| 252 return; | 261 return; |
| 253 | 262 |
| 254 EnterResource<PPB_InputEvent_API> enter(input_event, false); | 263 EnterResource<PPB_InputEvent_API> enter(input_event, false); |
| 255 if (enter.failed()) | 264 if (enter.failed()) |
| 256 return; | 265 return; |
| 257 | 266 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 281 uint32_t /*threshold*/) { | 290 uint32_t /*threshold*/) { |
| 282 // Does nothing. Not needed in-process. | 291 // Does nothing. Not needed in-process. |
| 283 } | 292 } |
| 284 | 293 |
| 285 void RunV8GC(PP_Instance instance) { | 294 void RunV8GC(PP_Instance instance) { |
| 286 content::PepperPluginInstance::Get(instance)->GetIsolate()-> | 295 content::PepperPluginInstance::Get(instance)->GetIsolate()-> |
| 287 RequestGarbageCollectionForTesting(v8::Isolate::kFullGarbageCollection); | 296 RequestGarbageCollectionForTesting(v8::Isolate::kFullGarbageCollection); |
| 288 } | 297 } |
| 289 | 298 |
| 290 const PPB_Testing_Private testing_interface = { | 299 const PPB_Testing_Private testing_interface = { |
| 291 &ReadImageData, &RunMessageLoop, | 300 &ReadImageData, |
| 292 &QuitMessageLoop, &GetLiveObjectsForInstance, | 301 &RunMessageLoop, |
| 293 &IsOutOfProcess, &SimulateInputEvent, | 302 &QuitMessageLoop, |
| 294 &GetDocumentURL, &GetLiveVars, | 303 &GetLiveObjectsForInstance, |
| 295 &SetMinimumArrayBufferSizeForShmem,&RunV8GC}; | 304 &IsOutOfProcess, |
| 305 &IsPeripheral, |
| 306 &SimulateInputEvent, |
| 307 &GetDocumentURL, |
| 308 &GetLiveVars, |
| 309 &SetMinimumArrayBufferSizeForShmem, |
| 310 &RunV8GC}; |
| 296 | 311 |
| 297 // GetInterface ---------------------------------------------------------------- | 312 // GetInterface ---------------------------------------------------------------- |
| 298 | 313 |
| 299 const void* InternalGetInterface(const char* name) { | 314 const void* InternalGetInterface(const char* name) { |
| 300 // Allow custom interface factories first stab at the GetInterface call. | 315 // Allow custom interface factories first stab at the GetInterface call. |
| 301 const void* custom_interface = | 316 const void* custom_interface = |
| 302 GetContentClient()->renderer()->CreatePPAPIInterface(name); | 317 GetContentClient()->renderer()->CreatePPAPIInterface(name); |
| 303 if (custom_interface) | 318 if (custom_interface) |
| 304 return custom_interface; | 319 return custom_interface; |
| 305 | 320 |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 channel_handle, | 736 channel_handle, |
| 722 peer_pid, | 737 peer_pid, |
| 723 plugin_child_id, | 738 plugin_child_id, |
| 724 false)) // is_external = false | 739 false)) // is_external = false |
| 725 return scoped_refptr<PluginModule>(); | 740 return scoped_refptr<PluginModule>(); |
| 726 | 741 |
| 727 return module; | 742 return module; |
| 728 } | 743 } |
| 729 | 744 |
| 730 } // namespace content | 745 } // namespace content |
| OLD | NEW |