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

Unified Diff: chrome/browser/nacl_host/pnacl_host.cc

Issue 23458015: Handle cache-control:no-store header in PNaCl translation cache (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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: chrome/browser/nacl_host/pnacl_host.cc
diff --git a/chrome/browser/nacl_host/pnacl_host.cc b/chrome/browser/nacl_host/pnacl_host.cc
index 2c3a082f61fe008c2c9a0735268abce821ecbbdb..dc2b815290d5140c69afb7a8dfab412b34df288d 100644
--- a/chrome/browser/nacl_host/pnacl_host.cc
+++ b/chrome/browser/nacl_host/pnacl_host.cc
@@ -268,11 +268,12 @@ void PnaclHost::OnTempFileReturn(const TranslationID& id,
// waiting for its result.
LOG(ERROR) << "OnTempFileReturn: temp file creation failed";
std::string key(entry->second.cache_key);
- bool is_incognito = entry->second.is_incognito;
+ bool may_have_waiting_translations = !entry->second.is_incognito &&
+ !entry->second.cache_info.has_no_store_header;
jvoung (off chromium) 2013/08/30 22:19:09 Would it be useful to put these checks in a helper
Derek Schuff 2013/09/03 22:14:52 Done.
entry->second.callback.Run(fd, false);
pending_translations_.erase(entry);
// No translations will be waiting for an incongnito translation
- if (!is_incognito)
+ if (may_have_waiting_translations)
RequeryMatchingTranslations(key);
return;
}
@@ -301,6 +302,8 @@ void PnaclHost::CheckCacheQueryReady(
it->first != entry->first &&
// and it's not incognito,
!it->second.is_incognito &&
+ // and it doesn't have the no-store header
+ !it->second.cache_info.has_no_store_header &&
// and if it's already gotten past this check and returned the miss.
it->second.got_cache_reply &&
it->second.got_nexe_fd) {
@@ -384,7 +387,8 @@ void PnaclHost::TranslationFinished(int render_process_id,
// TODO(dschuff): use a separate in-memory cache for incognito
// translations.
if (!entry->second.got_nexe_fd || !entry->second.got_cache_reply ||
- !success || entry->second.is_incognito) {
+ !success || entry->second.is_incognito ||
+ entry->second.cache_info.has_no_store_header) {
store_nexe = false;
} else if (!base::PostTaskAndReplyWithResult(
BrowserThread::GetBlockingPool(),
@@ -525,10 +529,11 @@ void PnaclHost::RendererClosing(int render_process_id) {
base::Bind(base::IgnoreResult(base::ClosePlatformFile),
to_erase->second.nexe_fd));
std::string key(to_erase->second.cache_key);
- bool is_incognito = to_erase->second.is_incognito;
+ bool may_have_waiting_translations = !to_erase->second.is_incognito &&
+ !to_erase->second.cache_info.has_no_store_header;
pending_translations_.erase(to_erase);
// No translations will be blocked waiting for an incongnito translation
- if (!is_incognito)
+ if (may_have_waiting_translations)
RequeryMatchingTranslations(key);
}
}
« no previous file with comments | « no previous file | chrome/browser/nacl_host/pnacl_host_unittest.cc » ('j') | components/nacl/common/pnacl_types.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698