Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1561)

Unified Diff: content/renderer/pepper/plugin_module.cc

Issue 1088763002: Plugin Power Saver: Add comprehensive browser tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0260-plugins-overhaul-prerender-tests
Patch Set: update isolate Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper/plugin_module.cc
diff --git a/content/renderer/pepper/plugin_module.cc b/content/renderer/pepper/plugin_module.cc
index 6d0a03c9684ed98f36df778ae89dbb32b44f197a..1cbdcaf34f616de3f66c6012ce99826e713e6aef 100644
--- a/content/renderer/pepper/plugin_module.cc
+++ b/content/renderer/pepper/plugin_module.cc
@@ -21,6 +21,7 @@
#include "content/renderer/pepper/pepper_hung_plugin_filter.h"
#include "content/renderer/pepper/pepper_plugin_instance_impl.h"
#include "content/renderer/pepper/pepper_plugin_registry.h"
+#include "content/renderer/pepper/plugin_instance_throttler_impl.h"
#include "content/renderer/pepper/ppapi_preferences_builder.h"
#include "content/renderer/pepper/ppb_image_data_impl.h"
#include "content/renderer/pepper/ppb_proxy_impl.h"
@@ -245,6 +246,14 @@ uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) {
PP_Bool IsOutOfProcess() { return PP_FALSE; }
+PP_Bool IsPeripheral(PP_Instance instance_id) {
+ PepperPluginInstanceImpl* plugin_instance =
+ host_globals->GetInstance(instance_id);
+ if (!plugin_instance || !plugin_instance->throttler())
+ return PP_FALSE;
+ return PP_FromBool(plugin_instance->throttler()->power_saver_enabled());
+}
+
void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) {
PepperPluginInstanceImpl* plugin_instance =
host_globals->GetInstance(instance);
@@ -288,11 +297,17 @@ void RunV8GC(PP_Instance instance) {
}
const PPB_Testing_Private testing_interface = {
- &ReadImageData, &RunMessageLoop,
- &QuitMessageLoop, &GetLiveObjectsForInstance,
- &IsOutOfProcess, &SimulateInputEvent,
- &GetDocumentURL, &GetLiveVars,
- &SetMinimumArrayBufferSizeForShmem,&RunV8GC};
+ &ReadImageData,
+ &RunMessageLoop,
+ &QuitMessageLoop,
+ &GetLiveObjectsForInstance,
+ &IsOutOfProcess,
+ &IsPeripheral,
+ &SimulateInputEvent,
+ &GetDocumentURL,
+ &GetLiveVars,
+ &SetMinimumArrayBufferSizeForShmem,
+ &RunV8GC};
// GetInterface ----------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698