Index: chrome/nacl/nacl_validation_query.cc |
diff --git a/chrome/nacl/nacl_validation_query.cc b/chrome/nacl/nacl_validation_query.cc |
index 37d9b7866e51fa0c356e4a4871b1a7f95f926b2e..0ff831c5f0025d45cb7f8a15cff9a18cf062c5b4 100644 |
--- a/chrome/nacl/nacl_validation_query.cc |
+++ b/chrome/nacl/nacl_validation_query.cc |
@@ -7,6 +7,8 @@ |
#include "base/logging.h" |
#include "crypto/nss_util.h" |
#include "chrome/nacl/nacl_validation_db.h" |
+#include "native_client/src/include/portability.h" |
Mark Seaborn
2013/05/24 22:48:11
Why? You shouldn't be using native_client/src/inc
|
+#include "native_client/src/trusted/validator/nacl_file_info.h" |
#include "native_client/src/trusted/validator/validation_cache.h" |
NaClValidationQueryContext::NaClValidationQueryContext( |
@@ -29,6 +31,13 @@ NaClValidationQuery* NaClValidationQueryContext::CreateQuery() { |
return query; |
} |
+bool NaClValidationQueryContext::ResolveFileToken( |
+ struct NaClFileToken* file_token, |
+ int32* fd, |
+ std::string* path) { |
+ return db_->ResolveFileToken(file_token, fd, path); |
+} |
+ |
NaClValidationQuery::NaClValidationQuery(NaClValidationDB* db, |
const std::string& profile_key) |
: state_(READY), |
@@ -127,6 +136,24 @@ static void DestroyQuery(void* query) { |
delete static_cast<NaClValidationQuery*>(query); |
} |
+static int ResolveFileToken(void* handle, struct NaClFileToken* file_token, |
+ int32* fd, char** file_path, |
+ uint32* file_path_length) { |
+ std::string path; |
+ *file_path = NULL; |
+ *file_path_length = 0; |
+ bool ok = static_cast<NaClValidationQueryContext*>(handle)-> |
+ ResolveFileToken(file_token, fd, &path); |
+ if (ok) { |
+ *file_path = static_cast<char*>(malloc(path.length() + 1)); |
+ CHECK(*file_path); |
+ memcpy(*file_path, path.data(), path.length()); |
+ (*file_path)[path.length()] = 0; |
+ *file_path_length = static_cast<uint32>(path.length()); |
+ } |
+ return ok; |
+} |
+ |
struct NaClValidationCache* CreateValidationCache( |
NaClValidationDB* db, const std::string& profile_key, |
const std::string& nacl_version) { |
@@ -140,5 +167,6 @@ struct NaClValidationCache* CreateValidationCache( |
cache->QueryKnownToValidate = QueryKnownToValidate; |
cache->SetKnownToValidate = SetKnownToValidate; |
cache->DestroyQuery = DestroyQuery; |
+ cache->ResolveFileToken = ResolveFileToken; |
return cache; |
} |