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

Unified Diff: components/nacl/renderer/plugin/module_ppapi.cc

Issue 1646903002: Revert of NaCl cleanup: Remove now-unneeded initialisation of NaCl libraries (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « components/nacl/renderer/plugin/module_ppapi.h ('k') | components/nacl/renderer/plugin/plugin.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/renderer/plugin/module_ppapi.cc
diff --git a/components/nacl/renderer/plugin/module_ppapi.cc b/components/nacl/renderer/plugin/module_ppapi.cc
index 6b090f091c489c31c429b7d50faf7b07544bff0b..cb0ae3cd25cabec55cb28d324a1c3ce1847a7284 100644
--- a/components/nacl/renderer/plugin/module_ppapi.cc
+++ b/components/nacl/renderer/plugin/module_ppapi.cc
@@ -7,14 +7,21 @@
#include "components/nacl/renderer/plugin/module_ppapi.h"
#include "components/nacl/renderer/plugin/plugin.h"
#include "components/nacl/renderer/plugin/utility.h"
+#include "native_client/src/shared/platform/nacl_secure_random.h"
+#include "native_client/src/shared/platform/nacl_time.h"
+#include "native_client/src/trusted/desc/nrd_all_modules.h"
namespace plugin {
ModulePpapi::ModulePpapi() : pp::Module(),
+ init_was_successful_(false),
private_interface_(NULL) {
}
ModulePpapi::~ModulePpapi() {
+ if (init_was_successful_) {
+ NaClNrdAllModulesFini();
+ }
}
bool ModulePpapi::Init() {
@@ -27,6 +34,19 @@
}
SetNaClInterface(private_interface_);
+#if NACL_LINUX || NACL_OSX
+ // Note that currently we do not need random numbers inside the
+ // NaCl trusted plugin on Unix, but NaClSecureRngModuleInit() is
+ // strict and will raise a fatal error unless we provide it with a
+ // /dev/urandom FD beforehand.
+ NaClSecureRngModuleSetUrandomFd(dup(private_interface_->UrandomFD()));
+#endif
+
+ // In the plugin, we don't need high resolution time of day.
+ NaClAllowLowResolutionTimeOfDay();
+ NaClNrdAllModulesInit();
+
+ init_was_successful_ = true;
return true;
}
« no previous file with comments | « components/nacl/renderer/plugin/module_ppapi.h ('k') | components/nacl/renderer/plugin/plugin.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698