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

Side by Side Diff: net/disk_cache/tracing_cache_backend.h

Issue 13731002: Cache Backend Proxy to intercept all cache events from the IO thread. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: added destructor Created 7 years, 8 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_DISK_CACHE_TRACING_CACHE_BACKEND_H_
6 #define NET_DISK_CACHE_TRACING_CACHE_BACKEND_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "net/disk_cache/disk_cache.h"
10 #include "net/disk_cache/in_flight_backend_io.h"
11 #include "net/disk_cache/stats.h"
12
13 namespace disk_cache {
14
15 class EntryProxy;
16
17 class NET_EXPORT TracingCacheBackend : public Backend,
rvargas (doing something else) 2013/04/05 19:25:13 what does this class do?
pasko-google - do not use 2013/04/09 11:53:17 Done.
18 public base::SupportsWeakPtr<TracingCacheBackend> {
19 public:
20 explicit TracingCacheBackend(Backend* backend);
21
22 virtual net::CacheType GetCacheType() const OVERRIDE;
23 virtual int32 GetEntryCount() const OVERRIDE;
24 virtual int OpenEntry(const std::string& key, Entry** entry,
25 const CompletionCallback& callback) OVERRIDE;
26 virtual int CreateEntry(const std::string& key, Entry** entry,
27 const CompletionCallback& callback) OVERRIDE;
28 virtual int DoomEntry(const std::string& key,
29 const CompletionCallback& callback) OVERRIDE;
30 virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE;
31 virtual int DoomEntriesBetween(base::Time initial_time,
32 base::Time end_time,
33 const CompletionCallback& callback) OVERRIDE;
34 virtual int DoomEntriesSince(base::Time initial_time,
35 const CompletionCallback& callback) OVERRIDE;
36 virtual int OpenNextEntry(void** iter, Entry** next_entry,
37 const CompletionCallback& callback) OVERRIDE;
38 virtual void EndEnumeration(void** iter) OVERRIDE;
39 virtual void GetStats(StatsItems* stats) OVERRIDE;
40 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE;
41
42 private:
43 friend class EntryProxy;
44 virtual ~TracingCacheBackend();
45 EntryProxy* FindOrCreateEntryProxy(Entry* entry);
46
47 void OnDeleteEntry(Entry* e);
48
49 void RecordEvent(int64 start_time, BackendIO::Operation op,
50 std::string key, Entry** entry, int rv);
51
52 void BackendOpComplete(int64 start_time,
53 BackendIO::Operation op,
54 std::string key,
55 Entry** entry,
56 const CompletionCallback& callback, int rv);
57
58 net::CompletionCallback BindCompletion(BackendIO::Operation op,
59 int64 start_time,
60 const std::string& key,
61 Entry **entry,
62 const net::CompletionCallback& cb);
63
64 scoped_ptr<Backend> backend_;
65 typedef std::map<Entry*, EntryProxy*> EntryToProxyMap;
66 EntryToProxyMap open_entries_;
67
68 DISALLOW_COPY_AND_ASSIGN(TracingCacheBackend);
69 };
70
71 } // namespace disk_cache
72
73 #endif // NET_DISK_CACHE_TRACING_CACHE_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698