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

Unified Diff: ppapi/native_client/src/trusted/plugin/pnacl_options.cc

Issue 16569002: Use HTTP response headers for PNaCl caching instead of bitcode hash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use RunAndClear Created 7 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/native_client/src/trusted/plugin/pnacl_options.h ('k') | ppapi/ppapi_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/native_client/src/trusted/plugin/pnacl_options.cc
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_options.cc b/ppapi/native_client/src/trusted/plugin/pnacl_options.cc
index ad31e88cce18da5e95acdbd7da6fcd7c6a9cf23d..e1c6b4befd63b3fa5f72b74fbb59aead74916099 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_options.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_options.cc
@@ -9,6 +9,21 @@
#include "native_client/src/include/nacl_string.h"
+namespace {
+
+nacl::string ReplaceBadFSChars(nacl::string str,
+ const nacl::string& bad_chars,
+ const nacl::string& replacement) {
+ size_t replace_pos = str.find_first_of(bad_chars);
+ while (replace_pos != nacl::string::npos) {
+ str = str.replace(replace_pos, 1, replacement);
+ replace_pos = str.find_first_of(bad_chars);
+ }
+ return str;
+}
+
+} // namespace
+
namespace plugin {
// Default to -O0 for now.
@@ -17,15 +32,24 @@ PnaclOptions::PnaclOptions() : translate_(false), opt_level_(0) { }
PnaclOptions::~PnaclOptions() {
}
-nacl::string PnaclOptions::GetCacheKey() {
+nacl::string PnaclOptions::GetCacheKey() const {
// TODO(jvoung): We need to read the PNaCl translator's manifest
// to grab the NaCl / PNaCl ABI version too.
nacl::stringstream ss;
// Cast opt_level_ as int so that it doesn't think it's a char.
ss << "-O:" << static_cast<int>(opt_level_)
<< ";flags:" << experimental_flags_
- << ";bitcode_hash:" << bitcode_hash_;
- return ss.str();
+ << ";cache_validators:" << cache_validators_;
+ // HTML5 FileSystem-based cache does not allow some characters which
+ // may appear in URLs, ETags, or Last-Modified times. Once we move to
+ // our own cache-backend, it will be more tolerant of various cache
+ // key values.
+ // See: http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#naming-restrictions
+ nacl::string key = ss.str();
+ key = ReplaceBadFSChars(key, "/", "_FWDSLASH_");
+ key = ReplaceBadFSChars(key, "\\", "_BCKSLASH_");
+ key = ReplaceBadFSChars(key, "\0", "_NULL_");
+ return key;
}
void PnaclOptions::set_opt_level(int8_t l) {
@@ -40,7 +64,7 @@ void PnaclOptions::set_opt_level(int8_t l) {
opt_level_ = l;
}
-std::vector<char> PnaclOptions::GetOptCommandline() {
+std::vector<char> PnaclOptions::GetOptCommandline() const {
std::vector<char> result;
std::vector<nacl::string> tokens;
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/pnacl_options.h ('k') | ppapi/ppapi_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698