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" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 PP_Bool IsOutOfProcess() { return PP_FALSE; } | 247 PP_Bool IsOutOfProcess() { return PP_FALSE; } |
248 | 248 |
249 PP_Bool IsPeripheral(PP_Instance instance_id) { | 249 PP_Bool IsPeripheral(PP_Instance instance_id) { |
250 PepperPluginInstanceImpl* plugin_instance = | 250 PepperPluginInstanceImpl* plugin_instance = |
251 host_globals->GetInstance(instance_id); | 251 host_globals->GetInstance(instance_id); |
252 if (!plugin_instance || !plugin_instance->throttler()) | 252 if (!plugin_instance || !plugin_instance->throttler()) |
253 return PP_FALSE; | 253 return PP_FALSE; |
254 return PP_FromBool(plugin_instance->throttler()->power_saver_enabled()); | 254 return PP_FromBool(plugin_instance->throttler()->power_saver_enabled()); |
255 } | 255 } |
256 | 256 |
| 257 PP_Bool IsThrottled(PP_Instance instance_id) { |
| 258 PepperPluginInstanceImpl* plugin_instance = |
| 259 host_globals->GetInstance(instance_id); |
| 260 if (!plugin_instance || !plugin_instance->throttler()) |
| 261 return PP_FALSE; |
| 262 return PP_FromBool(plugin_instance->throttler()->IsThrottled()); |
| 263 } |
| 264 |
257 void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) { | 265 void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) { |
258 PepperPluginInstanceImpl* plugin_instance = | 266 PepperPluginInstanceImpl* plugin_instance = |
259 host_globals->GetInstance(instance); | 267 host_globals->GetInstance(instance); |
260 if (!plugin_instance) | 268 if (!plugin_instance) |
261 return; | 269 return; |
262 | 270 |
263 EnterResource<PPB_InputEvent_API> enter(input_event, false); | 271 EnterResource<PPB_InputEvent_API> enter(input_event, false); |
264 if (enter.failed()) | 272 if (enter.failed()) |
265 return; | 273 return; |
266 | 274 |
(...skipping 29 matching lines...) Expand all Loading... |
296 RequestGarbageCollectionForTesting(v8::Isolate::kFullGarbageCollection); | 304 RequestGarbageCollectionForTesting(v8::Isolate::kFullGarbageCollection); |
297 } | 305 } |
298 | 306 |
299 const PPB_Testing_Private testing_interface = { | 307 const PPB_Testing_Private testing_interface = { |
300 &ReadImageData, | 308 &ReadImageData, |
301 &RunMessageLoop, | 309 &RunMessageLoop, |
302 &QuitMessageLoop, | 310 &QuitMessageLoop, |
303 &GetLiveObjectsForInstance, | 311 &GetLiveObjectsForInstance, |
304 &IsOutOfProcess, | 312 &IsOutOfProcess, |
305 &IsPeripheral, | 313 &IsPeripheral, |
| 314 &IsThrottled, |
306 &SimulateInputEvent, | 315 &SimulateInputEvent, |
307 &GetDocumentURL, | 316 &GetDocumentURL, |
308 &GetLiveVars, | 317 &GetLiveVars, |
309 &SetMinimumArrayBufferSizeForShmem, | 318 &SetMinimumArrayBufferSizeForShmem, |
310 &RunV8GC}; | 319 &RunV8GC}; |
311 | 320 |
312 // GetInterface ---------------------------------------------------------------- | 321 // GetInterface ---------------------------------------------------------------- |
313 | 322 |
314 const void* InternalGetInterface(const char* name) { | 323 const void* InternalGetInterface(const char* name) { |
315 // Allow custom interface factories first stab at the GetInterface call. | 324 // Allow custom interface factories first stab at the GetInterface call. |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 channel_handle, | 745 channel_handle, |
737 peer_pid, | 746 peer_pid, |
738 plugin_child_id, | 747 plugin_child_id, |
739 false)) // is_external = false | 748 false)) // is_external = false |
740 return scoped_refptr<PluginModule>(); | 749 return scoped_refptr<PluginModule>(); |
741 | 750 |
742 return module; | 751 return module; |
743 } | 752 } |
744 | 753 |
745 } // namespace content | 754 } // namespace content |
OLD | NEW |