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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: net/disk_cache/tracing_cache_backend.h
diff --git a/net/disk_cache/tracing_cache_backend.h b/net/disk_cache/tracing_cache_backend.h
new file mode 100644
index 0000000000000000000000000000000000000000..f9bd67f18f456837f3e4dca684604e7e24a67326
--- /dev/null
+++ b/net/disk_cache/tracing_cache_backend.h
@@ -0,0 +1,73 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_DISK_CACHE_TRACING_CACHE_BACKEND_H_
+#define NET_DISK_CACHE_TRACING_CACHE_BACKEND_H_
+
+#include "base/memory/weak_ptr.h"
+#include "net/disk_cache/disk_cache.h"
+#include "net/disk_cache/in_flight_backend_io.h"
+#include "net/disk_cache/stats.h"
+
+namespace disk_cache {
+
+class EntryProxy;
+
+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.
+ public base::SupportsWeakPtr<TracingCacheBackend> {
+ public:
+ explicit TracingCacheBackend(Backend* backend);
+
+ virtual net::CacheType GetCacheType() const OVERRIDE;
+ virtual int32 GetEntryCount() const OVERRIDE;
+ virtual int OpenEntry(const std::string& key, Entry** entry,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual int CreateEntry(const std::string& key, Entry** entry,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual int DoomEntry(const std::string& key,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE;
+ virtual int DoomEntriesBetween(base::Time initial_time,
+ base::Time end_time,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual int DoomEntriesSince(base::Time initial_time,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual int OpenNextEntry(void** iter, Entry** next_entry,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual void EndEnumeration(void** iter) OVERRIDE;
+ virtual void GetStats(StatsItems* stats) OVERRIDE;
+ virtual void OnExternalCacheHit(const std::string& key) OVERRIDE;
+
+ private:
+ friend class EntryProxy;
+ virtual ~TracingCacheBackend();
+ EntryProxy* FindOrCreateEntryProxy(Entry* entry);
+
+ void OnDeleteEntry(Entry* e);
+
+ void RecordEvent(int64 start_time, BackendIO::Operation op,
+ std::string key, Entry** entry, int rv);
+
+ void BackendOpComplete(int64 start_time,
+ BackendIO::Operation op,
+ std::string key,
+ Entry** entry,
+ const CompletionCallback& callback, int rv);
+
+ net::CompletionCallback BindCompletion(BackendIO::Operation op,
+ int64 start_time,
+ const std::string& key,
+ Entry **entry,
+ const net::CompletionCallback& cb);
+
+ scoped_ptr<Backend> backend_;
+ typedef std::map<Entry*, EntryProxy*> EntryToProxyMap;
+ EntryToProxyMap open_entries_;
+
+ DISALLOW_COPY_AND_ASSIGN(TracingCacheBackend);
+};
+
+} // namespace disk_cache
+
+#endif // NET_DISK_CACHE_TRACING_CACHE_BACKEND_H_

Powered by Google App Engine
This is Rietveld 408576698