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

Unified Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc

Issue 8982006: Add GetLiveVars to PPB_Testing_Dev. Fix leaks it uncovered. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged Created 9 years 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: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc
index 5c81a2ac454322b6a5c9e60491bb82d9eab0da9f..dbd01b445a9a984b1adf6c5fcabf83c4dd5e6d09 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc
@@ -6,12 +6,14 @@
#include <cstddef>
#include <new>
+#include <vector>
#include "native_client/src/include/nacl_scoped_ptr.h"
#include "native_client/src/include/portability.h"
#include "native_client/src/shared/ppapi_proxy/object_serialize.h"
#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
+#include "native_client/src/shared/ppapi_proxy/proxy_var_cache.h"
#include "native_client/src/shared/ppapi_proxy/utility.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/pp_completion_callback.h"
@@ -145,6 +147,18 @@ struct PP_Var GetDocumentURL(PP_Instance instance,
return url;
}
+// TODO(dmichael): Ideally we could get a way to check the number of vars in the
+// host-side tracker when running NaCl, to make sure the proxy does not leak
+// host-side vars.
+uint32_t GetLiveVars(PP_Var live_vars[], uint32_t array_size) {
+ std::vector<PP_Var> vars = ProxyVarCache::GetInstance().GetLiveVars();
+ for (size_t i = 0u;
+ i < std::min(static_cast<size_t>(array_size), vars.size());
+ ++i)
+ live_vars[i] = vars[i];
+ return vars.size();
+}
+
} // namespace
const PPB_Testing_Dev* PluginTesting::GetInterface() {
@@ -155,7 +169,8 @@ const PPB_Testing_Dev* PluginTesting::GetInterface() {
GetLiveObjectsForInstance,
IsOutOfProcess,
SimulateInputEvent,
- GetDocumentURL
+ GetDocumentURL,
+ GetLiveVars
};
return &testing_interface;
}
« no previous file with comments | « ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc ('k') | ppapi/native_client/src/shared/ppapi_proxy/proxy_var_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698