| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/nacl/browser/pnacl_translation_cache.h" | 5 #include "components/nacl/browser/pnacl_translation_cache.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 // Beware that any changes to this function or to PnaclCacheInfo will | 407 // Beware that any changes to this function or to PnaclCacheInfo will |
| 408 // effectively invalidate existing translation cache entries. | 408 // effectively invalidate existing translation cache entries. |
| 409 | 409 |
| 410 // static | 410 // static |
| 411 std::string PnaclTranslationCache::GetKey(const nacl::PnaclCacheInfo& info) { | 411 std::string PnaclTranslationCache::GetKey(const nacl::PnaclCacheInfo& info) { |
| 412 if (!info.pexe_url.is_valid() || info.abi_version < 0 || info.opt_level < 0 || | 412 if (!info.pexe_url.is_valid() || info.abi_version < 0 || info.opt_level < 0 || |
| 413 info.extra_flags.size() > 512) | 413 info.extra_flags.size() > 512) |
| 414 return std::string(); | 414 return std::string(); |
| 415 std::string retval("ABI:"); | 415 std::string retval("ABI:"); |
| 416 retval += IntToString(info.abi_version) + ";" + "opt:" + | 416 retval += IntToString(info.abi_version) + ";" + "opt:" + |
| 417 IntToString(info.opt_level) + ";" + "URL:"; | 417 IntToString(info.opt_level) + |
| 418 (info.use_subzero ? "subzero;" : ";") + "URL:"; |
| 418 // Filter the username, password, and ref components from the URL | 419 // Filter the username, password, and ref components from the URL |
| 419 GURL::Replacements replacements; | 420 GURL::Replacements replacements; |
| 420 replacements.ClearUsername(); | 421 replacements.ClearUsername(); |
| 421 replacements.ClearPassword(); | 422 replacements.ClearPassword(); |
| 422 replacements.ClearRef(); | 423 replacements.ClearRef(); |
| 423 GURL key_url(info.pexe_url.ReplaceComponents(replacements)); | 424 GURL key_url(info.pexe_url.ReplaceComponents(replacements)); |
| 424 retval += key_url.spec() + ";"; | 425 retval += key_url.spec() + ";"; |
| 425 // You would think that there is already code to format base::Time values | 426 // You would think that there is already code to format base::Time values |
| 426 // somewhere, but I haven't found it yet. In any case, doing it ourselves | 427 // somewhere, but I haven't found it yet. In any case, doing it ourselves |
| 427 // here means we can keep the format stable. | 428 // here means we can keep the format stable. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 443 } | 444 } |
| 444 | 445 |
| 445 int PnaclTranslationCache::DoomEntriesBetween( | 446 int PnaclTranslationCache::DoomEntriesBetween( |
| 446 base::Time initial, | 447 base::Time initial, |
| 447 base::Time end, | 448 base::Time end, |
| 448 const CompletionCallback& callback) { | 449 const CompletionCallback& callback) { |
| 449 return disk_cache_->DoomEntriesBetween(initial, end, callback); | 450 return disk_cache_->DoomEntriesBetween(initial, end, callback); |
| 450 } | 451 } |
| 451 | 452 |
| 452 } // namespace pnacl | 453 } // namespace pnacl |
| OLD | NEW |