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

Side by Side Diff: chrome/browser/nacl_host/pnacl_translation_cache.h

Issue 20737002: Change the API of disk_cache::CreateCacheBackend to use scoped_ptr (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix new test 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/nacl_host/pnacl_translation_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CHROME_BROWSER_NACL_HOST_PNACL_TRANSLATION_CACHE_H_ 5 #ifndef CHROME_BROWSER_NACL_HOST_PNACL_TRANSLATION_CACHE_H_
6 #define CHROME_BROWSER_NACL_HOST_PNACL_TRANSLATION_CACHE_H_ 6 #define CHROME_BROWSER_NACL_HOST_PNACL_TRANSLATION_CACHE_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 // Return the cache key for |info| 71 // Return the cache key for |info|
72 static std::string GetKey(const nacl::PnaclCacheInfo& info); 72 static std::string GetKey(const nacl::PnaclCacheInfo& info);
73 73
74 private: 74 private:
75 friend class PnaclTranslationCacheEntry; 75 friend class PnaclTranslationCacheEntry;
76 friend class PnaclTranslationCacheTest; 76 friend class PnaclTranslationCacheTest;
77 // PnaclTranslationCacheEntry should only use the 77 // PnaclTranslationCacheEntry should only use the
78 // OpComplete and backend methods on PnaclTranslationCache. 78 // OpComplete and backend methods on PnaclTranslationCache.
79 void OpComplete(PnaclTranslationCacheEntry* entry); 79 void OpComplete(PnaclTranslationCacheEntry* entry);
80 disk_cache::Backend* backend() { return disk_cache_; } 80 disk_cache::Backend* backend() { return disk_cache_.get(); }
81 81
82 int InitWithDiskBackend(const base::FilePath& disk_cache_dir, 82 int InitWithDiskBackend(const base::FilePath& disk_cache_dir,
83 int cache_size, 83 int cache_size,
84 const CompletionCallback& callback); 84 const CompletionCallback& callback);
85 85
86 int InitWithMemBackend(int cache_size, const CompletionCallback& callback); 86 int InitWithMemBackend(int cache_size, const CompletionCallback& callback);
87 87
88 int Init(net::CacheType, 88 int Init(net::CacheType,
89 const base::FilePath& directory, 89 const base::FilePath& directory,
90 int cache_size, 90 int cache_size,
91 const CompletionCallback& callback); 91 const CompletionCallback& callback);
92 92
93 void OnCreateBackendComplete(int rv); 93 void OnCreateBackendComplete(int rv);
94 94
95 disk_cache::Backend* disk_cache_; 95 scoped_ptr<disk_cache::Backend> disk_cache_;
96 CompletionCallback init_callback_; 96 CompletionCallback init_callback_;
97 bool in_memory_; 97 bool in_memory_;
98 std::map<void*, scoped_refptr<PnaclTranslationCacheEntry> > open_entries_; 98 std::map<void*, scoped_refptr<PnaclTranslationCacheEntry> > open_entries_;
99 99
100 DISALLOW_COPY_AND_ASSIGN(PnaclTranslationCache); 100 DISALLOW_COPY_AND_ASSIGN(PnaclTranslationCache);
101 }; 101 };
102 102
103 } // namespace pnacl 103 } // namespace pnacl
104 104
105 #endif // CHROME_BROWSER_NACL_HOST_PNACL_TRANSLATION_CACHE_H_ 105 #endif // CHROME_BROWSER_NACL_HOST_PNACL_TRANSLATION_CACHE_H_
OLDNEW
« 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