Index: trunk/src/chrome/browser/nacl_host/pnacl_host.cc |
=================================================================== |
--- trunk/src/chrome/browser/nacl_host/pnacl_host.cc (revision 221280) |
+++ trunk/src/chrome/browser/nacl_host/pnacl_host.cc (working copy) |
@@ -45,12 +45,6 @@ |
cache_info(nacl::PnaclCacheInfo()) {} |
PnaclHost::PendingTranslation::~PendingTranslation() {} |
-bool PnaclHost::TranslationMayBeCached( |
- const PendingTranslationMap::iterator& entry) { |
- return !entry->second.is_incognito && |
- !entry->second.cache_info.has_no_store_header; |
-} |
- |
/////////////////////////////////////// Initialization |
static base::FilePath GetCachePath() { |
@@ -274,10 +268,11 @@ |
// 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; |
entry->second.callback.Run(fd, false); |
pending_translations_.erase(entry); |
- // No translations will be waiting for entries that will not be stored. |
- if (TranslationMayBeCached(entry)) |
+ // No translations will be waiting for an incongnito translation |
+ if (!is_incognito) |
RequeryMatchingTranslations(key); |
return; |
} |
@@ -304,9 +299,9 @@ |
if (it->second.cache_key == entry->second.cache_key && |
// and it's not this translation, |
it->first != entry->first && |
- // and it can be stored in the cache, |
- TranslationMayBeCached(it) && |
- // and it's already gotten past this check and returned the miss. |
+ // and it's not incognito, |
+ !it->second.is_incognito && |
+ // and if it's already gotten past this check and returned the miss. |
it->second.got_cache_reply && |
it->second.got_nexe_fd) { |
return; |
@@ -389,7 +384,7 @@ |
// TODO(dschuff): use a separate in-memory cache for incognito |
// translations. |
if (!entry->second.got_nexe_fd || !entry->second.got_cache_reply || |
- !success || !TranslationMayBeCached(entry)) { |
+ !success || entry->second.is_incognito) { |
store_nexe = false; |
} else if (!base::PostTaskAndReplyWithResult( |
BrowserThread::GetBlockingPool(), |
@@ -530,9 +525,10 @@ |
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; |
pending_translations_.erase(to_erase); |
- // No translations will be waiting for entries that will not be stored. |
- if (TranslationMayBeCached(to_erase)) |
+ // No translations will be blocked waiting for an incongnito translation |
+ if (!is_incognito) |
RequeryMatchingTranslations(key); |
} |
} |