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

Unified Diff: chrome/browser/nacl_host/pnacl_translation_cache.h

Issue 21075004: Clean up PnaclTranslationCache interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: handle null base::Time explicitly Created 7 years, 5 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 | « no previous file | chrome/browser/nacl_host/pnacl_translation_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/nacl_host/pnacl_translation_cache.h
diff --git a/chrome/browser/nacl_host/pnacl_translation_cache.h b/chrome/browser/nacl_host/pnacl_translation_cache.h
index 96f03c01246d5eebb4927b8cdc86242e970d1907..1cd51ee4b092c6fb4f2555d718a1c04fb0fb4f49 100644
--- a/chrome/browser/nacl_host/pnacl_translation_cache.h
+++ b/chrome/browser/nacl_host/pnacl_translation_cache.h
@@ -20,8 +20,18 @@ namespace disk_cache {
class Backend;
}
+namespace nacl {
+struct PnaclCacheInfo;
+}
+
+namespace net {
+class DrainableIOBuffer;
+}
+
namespace pnacl {
typedef base::Callback<void(int)> CompletionCallback;
+typedef base::Callback<void(int, scoped_refptr<net::DrainableIOBuffer>)>
+ GetNexeCallback;
class PnaclTranslationCacheEntry;
extern const int kMaxMemCacheSize;
@@ -38,27 +48,32 @@ class PnaclTranslationCache
bool in_memory,
const CompletionCallback& callback);
- // Store the nexe in the translation cache.
- void StoreNexe(const std::string& key, const std::string& nexe);
+ // Store the nexe in the translation cache. A reference to |nexe_data| is
+ // held until completion or cancellation.
+ void StoreNexe(const std::string& key, net::DrainableIOBuffer* nexe_data);
// Store the nexe in the translation cache, and call |callback| with
// the result. The result passed to the callback is 0 on success and
- // <0 otherwise.
+ // <0 otherwise. A reference to |nexe_data| is held until completion
+ // or cancellation.
void StoreNexe(const std::string& key,
- const std::string& nexe,
+ net::DrainableIOBuffer* nexe_data,
const CompletionCallback& callback);
// Retrieve the nexe from the translation cache. Write the data into |nexe|
- // and call |callback| with the result (0 on success and <0 otherwise)
- void GetNexe(const std::string& key,
- std::string* nexe,
- const CompletionCallback& callback);
+ // and call |callback|, passing a result code (0 on success and <0 otherwise),
+ // and a DrainableIOBuffer with the data.
+ void GetNexe(const std::string& key, const GetNexeCallback& callback);
// Return the number of entries in the cache backend.
int Size();
+ // Return the cache key for |info|
+ static std::string GetKey(const nacl::PnaclCacheInfo& info);
+
private:
friend class PnaclTranslationCacheEntry;
+ friend class PnaclTranslationCacheTest;
// PnaclTranslationCacheEntry should only use the
// OpComplete and backend methods on PnaclTranslationCache.
void OpComplete(PnaclTranslationCacheEntry* entry);
« no previous file with comments | « no previous file | chrome/browser/nacl_host/pnacl_translation_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698