summaryrefslogtreecommitdiffstats
path: root/chrome/nacl
diff options
context:
space:
mode:
authorncbray@chromium.org <ncbray@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-20 22:57:29 +0000
committerncbray@chromium.org <ncbray@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-20 22:57:29 +0000
commit86185c3874df866c9f3e913c2e65809ba83f14b4 (patch)
tree7710a1d884d929b57eb786a149d13585fc324e42 /chrome/nacl
parent7ce178cb01203b7be37fa9fd195099ff9cbb2b02 (diff)
downloadchromium_src-86185c3874df866c9f3e913c2e65809ba83f14b4.zip
chromium_src-86185c3874df866c9f3e913c2e65809ba83f14b4.tar.gz
chromium_src-86185c3874df866c9f3e913c2e65809ba83f14b4.tar.bz2
NaCl validation caching: improve startup speed by ~70 ms on Linux.
HMAC was attempting to completely initialize NSS, unnecessarily. BUG= http://code.google.com/p/nativeclient/issues/detail?id=2515 TEST= none Review URL: http://codereview.chromium.org/10146001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133290 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/nacl')
-rw-r--r--chrome/nacl/nacl_validation_query.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/chrome/nacl/nacl_validation_query.cc b/chrome/nacl/nacl_validation_query.cc
index 5191ab4..31e6545 100644
--- a/chrome/nacl/nacl_validation_query.cc
+++ b/chrome/nacl/nacl_validation_query.cc
@@ -5,6 +5,7 @@
#include "chrome/nacl/nacl_validation_query.h"
#include "base/logging.h"
+#include "crypto/nss_util.h"
#include "chrome/nacl/nacl_validation_db.h"
#include "native_client/src/trusted/validator/validation_cache.h"
@@ -34,6 +35,12 @@ NaClValidationQuery::NaClValidationQuery(NaClValidationDB* db,
hasher_(crypto::HMAC::SHA256),
db_(db),
buffer_length_(0) {
+ // Without this line on Linux, HMAC::Init will instantiate a singleton that
+ // in turn attempts to open a file. Disabling this behavior avoids a ~70 ms
+ // stall the first time HMAC is used.
+#if defined(OS_LINUX)
+ crypto::ForceNSSNoDBInit();
+#endif
CHECK(hasher_.Init(profile_key));
}