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

Side by Side Diff: webkit/appcache/appcache_disk_cache.h

Issue 9064007: base::Bind: Remove OldCompletionCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 WEBKIT_APPCACHE_APPCACHE_DISK_CACHE_H_ 5 #ifndef WEBKIT_APPCACHE_APPCACHE_DISK_CACHE_H_
6 #define WEBKIT_APPCACHE_APPCACHE_DISK_CACHE_H_ 6 #define WEBKIT_APPCACHE_APPCACHE_DISK_CACHE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 27 matching lines...) Expand all
38 bool is_disabled() const { return is_disabled_; } 38 bool is_disabled() const { return is_disabled_; }
39 39
40 virtual int CreateEntry(int64 key, Entry** entry, 40 virtual int CreateEntry(int64 key, Entry** entry,
41 const net::CompletionCallback& callback) OVERRIDE; 41 const net::CompletionCallback& callback) OVERRIDE;
42 virtual int OpenEntry(int64 key, Entry** entry, 42 virtual int OpenEntry(int64 key, Entry** entry,
43 const net::CompletionCallback& callback) OVERRIDE; 43 const net::CompletionCallback& callback) OVERRIDE;
44 virtual int DoomEntry(int64 key, 44 virtual int DoomEntry(int64 key,
45 const net::CompletionCallback& callback) OVERRIDE; 45 const net::CompletionCallback& callback) OVERRIDE;
46 46
47 private: 47 private:
48 struct CreateBackendDataShim;
48 class EntryImpl; 49 class EntryImpl;
49 50
50 class CreateBackendCallback
51 : public net::CancelableOldCompletionCallback<AppCacheDiskCache> {
52 public:
53 typedef net::CancelableOldCompletionCallback<AppCacheDiskCache> BaseClass;
54 CreateBackendCallback(AppCacheDiskCache* object,
55 void (AppCacheDiskCache::* method)(int))
56 : BaseClass(object, method), backend_ptr_(NULL) {}
57
58 disk_cache::Backend* backend_ptr_; // Accessed directly.
59 private:
60 virtual ~CreateBackendCallback() {
61 delete backend_ptr_;
62 }
63 };
64
65 // PendingCalls allow CreateEntry, OpenEntry, and DoomEntry to be called 51 // PendingCalls allow CreateEntry, OpenEntry, and DoomEntry to be called
66 // immediately after construction, without waiting for the 52 // immediately after construction, without waiting for the
67 // underlying disk_cache::Backend to be fully constructed. Early 53 // underlying disk_cache::Backend to be fully constructed. Early
68 // calls are queued up and serviced once the disk_cache::Backend is 54 // calls are queued up and serviced once the disk_cache::Backend is
69 // really ready to go. 55 // really ready to go.
70 enum PendingCallType { 56 enum PendingCallType {
71 CREATE, 57 CREATE,
72 OPEN, 58 OPEN,
73 DOOM 59 DOOM
74 }; 60 };
(...skipping 18 matching lines...) Expand all
93 } 79 }
94 80
95 ~PendingCall(); 81 ~PendingCall();
96 }; 82 };
97 typedef std::vector<PendingCall> PendingCalls; 83 typedef std::vector<PendingCall> PendingCalls;
98 84
99 class ActiveCall; 85 class ActiveCall;
100 typedef std::set<ActiveCall*> ActiveCalls; 86 typedef std::set<ActiveCall*> ActiveCalls;
101 87
102 bool is_initializing() const { 88 bool is_initializing() const {
103 return create_backend_callback_.get() != NULL; 89 return !create_backend_callback_.IsCancelled();
104 } 90 }
105 disk_cache::Backend* disk_cache() { return disk_cache_.get(); } 91 disk_cache::Backend* disk_cache() { return disk_cache_.get(); }
106 int Init(net::CacheType cache_type, const FilePath& directory, 92 int Init(net::CacheType cache_type, const FilePath& directory,
107 int cache_size, bool force, base::MessageLoopProxy* cache_thread, 93 int cache_size, bool force, base::MessageLoopProxy* cache_thread,
108 const net::CompletionCallback& callback); 94 const net::CompletionCallback& callback);
109 void OnCreateBackendComplete(int rv); 95 // The |unused| parameter is a small hack so that we can have the
groby-ooo-7-16 2012/01/03 18:32:25 Which one is |unused|. I assume you mean |backend|
James Hawkins 2012/01/03 18:39:21 Done.
96 // CreateBackendDataShim object owned by the Callback that is created for
97 // this method.
98 void OnCreateBackendComplete(disk_cache::Backend** backend, int rv);
110 void AddActiveCall(ActiveCall* call) { active_calls_.insert(call); } 99 void AddActiveCall(ActiveCall* call) { active_calls_.insert(call); }
111 void RemoveActiveCall(ActiveCall* call) { active_calls_.erase(call); } 100 void RemoveActiveCall(ActiveCall* call) { active_calls_.erase(call); }
112 101
113 bool is_disabled_; 102 bool is_disabled_;
114 net::CompletionCallback init_callback_; 103 net::CompletionCallback init_callback_;
115 scoped_refptr<CreateBackendCallback> create_backend_callback_; 104 net::CancelableCompletionCallback create_backend_callback_;
116 PendingCalls pending_calls_; 105 PendingCalls pending_calls_;
117 ActiveCalls active_calls_; 106 ActiveCalls active_calls_;
118 scoped_ptr<disk_cache::Backend> disk_cache_; 107 scoped_ptr<disk_cache::Backend> disk_cache_;
119 }; 108 };
120 109
121 } // namespace appcache 110 } // namespace appcache
122 111
123 #endif // WEBKIT_APPCACHE_APPCACHE_DISK_CACHE_H_ 112 #endif // WEBKIT_APPCACHE_APPCACHE_DISK_CACHE_H_
124 113
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698