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

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 windows specific file. 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 unified diff | Download patch | Annotate | Revision Log
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 const CompletionCallback& callback); 55 const CompletionCallback& callback);
56 56
57 // Return the number of entries in the cache backend. 57 // Return the number of entries in the cache backend.
58 int Size(); 58 int Size();
59 59
60 private: 60 private:
61 friend class PnaclTranslationCacheEntry; 61 friend class PnaclTranslationCacheEntry;
62 // PnaclTranslationCacheEntry should only use the 62 // PnaclTranslationCacheEntry should only use the
63 // OpComplete and backend methods on PnaclTranslationCache. 63 // OpComplete and backend methods on PnaclTranslationCache.
64 void OpComplete(PnaclTranslationCacheEntry* entry); 64 void OpComplete(PnaclTranslationCacheEntry* entry);
65 disk_cache::Backend* backend() { return disk_cache_; } 65 disk_cache::Backend* backend() { return disk_cache_.get(); }
66 66
67 int InitWithDiskBackend(const base::FilePath& disk_cache_dir, 67 int InitWithDiskBackend(const base::FilePath& disk_cache_dir,
68 int cache_size, 68 int cache_size,
69 const CompletionCallback& callback); 69 const CompletionCallback& callback);
70 70
71 int InitWithMemBackend(int cache_size, const CompletionCallback& callback); 71 int InitWithMemBackend(int cache_size, const CompletionCallback& callback);
72 72
73 int Init(net::CacheType, 73 int Init(net::CacheType,
74 const base::FilePath& directory, 74 const base::FilePath& directory,
75 int cache_size, 75 int cache_size,
76 const CompletionCallback& callback); 76 const CompletionCallback& callback);
77 77
78 void OnCreateBackendComplete(int rv); 78 void OnCreateBackendComplete(int rv);
79 79
80 disk_cache::Backend* disk_cache_; 80 scoped_ptr<disk_cache::Backend> disk_cache_;
81 CompletionCallback init_callback_; 81 CompletionCallback init_callback_;
82 bool in_memory_; 82 bool in_memory_;
83 std::map<void*, scoped_refptr<PnaclTranslationCacheEntry> > open_entries_; 83 std::map<void*, scoped_refptr<PnaclTranslationCacheEntry> > open_entries_;
84 84
85 DISALLOW_COPY_AND_ASSIGN(PnaclTranslationCache); 85 DISALLOW_COPY_AND_ASSIGN(PnaclTranslationCache);
86 }; 86 };
87 87
88 } // namespace pnacl 88 } // namespace pnacl
89 89
90 #endif // CHROME_BROWSER_NACL_HOST_PNACL_TRANSLATION_CACHE_H_ 90 #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') | net/disk_cache/backend_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698