OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 NET_DISK_CACHE_TRACING_CACHE_BACKEND_H_ | 5 #ifndef NET_DISK_CACHE_TRACING_CACHE_BACKEND_H_ |
6 #define NET_DISK_CACHE_TRACING_CACHE_BACKEND_H_ | 6 #define NET_DISK_CACHE_TRACING_CACHE_BACKEND_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "net/disk_cache/disk_cache.h" | 9 #include "net/disk_cache/disk_cache.h" |
10 #include "net/disk_cache/stats.h" | 10 #include "net/disk_cache/stats.h" |
11 | 11 |
12 namespace disk_cache { | 12 namespace disk_cache { |
13 | 13 |
14 class EntryProxy; | 14 class EntryProxy; |
15 | 15 |
16 // The TracingCacheBackend implements the Cache Backend interface. It intercepts | 16 // The TracingCacheBackend implements the Cache Backend interface. It intercepts |
17 // all backend operations from the IO thread and records the time from the start | 17 // all backend operations from the IO thread and records the time from the start |
18 // of the operation until the result is delivered. | 18 // of the operation until the result is delivered. |
19 class NET_EXPORT TracingCacheBackend : public Backend, | 19 class NET_EXPORT TracingCacheBackend : public Backend, |
20 public base::SupportsWeakPtr<TracingCacheBackend> { | 20 public base::SupportsWeakPtr<TracingCacheBackend> { |
21 public: | 21 public: |
22 explicit TracingCacheBackend(Backend* backend); | 22 explicit TracingCacheBackend(scoped_ptr<Backend> backend); |
23 | 23 |
24 virtual net::CacheType GetCacheType() const OVERRIDE; | 24 virtual net::CacheType GetCacheType() const OVERRIDE; |
25 virtual int32 GetEntryCount() const OVERRIDE; | 25 virtual int32 GetEntryCount() const OVERRIDE; |
26 virtual int OpenEntry(const std::string& key, Entry** entry, | 26 virtual int OpenEntry(const std::string& key, Entry** entry, |
27 const CompletionCallback& callback) OVERRIDE; | 27 const CompletionCallback& callback) OVERRIDE; |
28 virtual int CreateEntry(const std::string& key, Entry** entry, | 28 virtual int CreateEntry(const std::string& key, Entry** entry, |
29 const CompletionCallback& callback) OVERRIDE; | 29 const CompletionCallback& callback) OVERRIDE; |
30 virtual int DoomEntry(const std::string& key, | 30 virtual int DoomEntry(const std::string& key, |
31 const CompletionCallback& callback) OVERRIDE; | 31 const CompletionCallback& callback) OVERRIDE; |
32 virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE; | 32 virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 scoped_ptr<Backend> backend_; | 72 scoped_ptr<Backend> backend_; |
73 typedef std::map<Entry*, EntryProxy*> EntryToProxyMap; | 73 typedef std::map<Entry*, EntryProxy*> EntryToProxyMap; |
74 EntryToProxyMap open_entries_; | 74 EntryToProxyMap open_entries_; |
75 | 75 |
76 DISALLOW_COPY_AND_ASSIGN(TracingCacheBackend); | 76 DISALLOW_COPY_AND_ASSIGN(TracingCacheBackend); |
77 }; | 77 }; |
78 | 78 |
79 } // namespace disk_cache | 79 } // namespace disk_cache |
80 | 80 |
81 #endif // NET_DISK_CACHE_TRACING_CACHE_BACKEND_H_ | 81 #endif // NET_DISK_CACHE_TRACING_CACHE_BACKEND_H_ |
OLD | NEW |