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

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: simplify tst 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
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 05eecf27bf6d8a01bc70d44eac60ef0c8cc90207..5e2b3338a8f3c1d10f53c38d1874cb0961f2f92b 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) {
Derek Schuff 2013/06/07 21:38:04 while (
jvoung (off chromium) 2013/06/07 23:46:25 Done.
+ 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 some characters which may appear
Derek Schuff 2013/06/07 21:38:04 does not some?
jvoung (off chromium) 2013/06/07 23:46:25 Done.
+ // in URLs, ETags, or Last-Modified times. Once we move to our own
+ // cache-backend, hopefully 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;

Powered by Google App Engine
This is Rietveld 408576698