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

Unified Diff: ppapi/tests/power_saver_test_plugin.cc

Issue 1182283002: Plugin Power Saver: Fix Dr. Memory leaks in browser tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « ppapi/examples/gamepad/gamepad.cc ('k') | tools/valgrind/drmemory/suppressions_full.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/power_saver_test_plugin.cc
diff --git a/ppapi/tests/power_saver_test_plugin.cc b/ppapi/tests/power_saver_test_plugin.cc
index 44aef4d9577b5f41f02d2111beed28b4d9fc4068..521fafa8a960029542d160834abbbf9192a0ffdd 100644
--- a/ppapi/tests/power_saver_test_plugin.cc
+++ b/ppapi/tests/power_saver_test_plugin.cc
@@ -15,11 +15,14 @@
#undef PostMessage
#endif
+static void DummyCompletionCallback(void*, int32_t) {
+}
+
// This is a simple C++ Pepper plugin that enables Plugin Power Saver tests.
class PowerSaverTestInstance : public pp::Instance {
public:
explicit PowerSaverTestInstance(PP_Instance instance)
- : pp::Instance(instance), callback_factory_(this) {}
+ : pp::Instance(instance) {}
~PowerSaverTestInstance() override {}
bool Init(uint32_t argc, const char* argn[], const char* argv[]) {
@@ -42,11 +45,11 @@ class PowerSaverTestInstance : public pp::Instance {
if (!BindGraphics(device_context_))
return;
+ // Since we draw a static image, we only need to make a new frame when
+ // the device is initialized or the view size changes.
Paint();
}
- void OnFlush(int32_t) { Paint(); }
-
private:
void Paint() {
pp::ImageData image(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
@@ -64,13 +67,11 @@ class PowerSaverTestInstance : public pp::Instance {
device_context_.ReplaceContents(&image);
device_context_.Flush(
- callback_factory_.NewCallback(&PowerSaverTestInstance::OnFlush));
+ pp::CompletionCallback(&DummyCompletionCallback, nullptr));
}
pp::View view_;
pp::Graphics2D device_context_;
-
- pp::CompletionCallbackFactory<PowerSaverTestInstance> callback_factory_;
};
class PowerSaverTestModule : public pp::Module {
« no previous file with comments | « ppapi/examples/gamepad/gamepad.cc ('k') | tools/valgrind/drmemory/suppressions_full.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698