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

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

Issue 6613027: Adds memory cache logging, and updates disk cache logging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Oops Created 9 years, 9 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
« no previous file with comments | « net/disk_cache/entry_impl.cc ('k') | net/disk_cache/mem_backend_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // See net/disk_cache/disk_cache.h for the public interface of the cache. 5 // See net/disk_cache/disk_cache.h for the public interface of the cache.
6 6
7 #ifndef NET_DISK_CACHE_MEM_BACKEND_IMPL_H__ 7 #ifndef NET_DISK_CACHE_MEM_BACKEND_IMPL_H__
8 #define NET_DISK_CACHE_MEM_BACKEND_IMPL_H__ 8 #define NET_DISK_CACHE_MEM_BACKEND_IMPL_H__
9 #pragma once 9 #pragma once
10 10
11 #include "base/hash_tables.h" 11 #include "base/hash_tables.h"
12 12
13 #include "net/disk_cache/disk_cache.h" 13 #include "net/disk_cache/disk_cache.h"
14 #include "net/disk_cache/mem_rankings.h" 14 #include "net/disk_cache/mem_rankings.h"
15 15
16 namespace net {
17 class NetLog;
18 } // namespace net
19
16 namespace disk_cache { 20 namespace disk_cache {
17 21
18 class MemEntryImpl; 22 class MemEntryImpl;
19 23
20 // This class implements the Backend interface. An object of this class handles 24 // This class implements the Backend interface. An object of this class handles
21 // the operations of the cache without writing to disk. 25 // the operations of the cache without writing to disk.
22 class MemBackendImpl : public Backend { 26 class MemBackendImpl : public Backend {
23 public: 27 public:
24 MemBackendImpl(); 28 explicit MemBackendImpl(net::NetLog* net_log);
25 ~MemBackendImpl(); 29 ~MemBackendImpl();
26 30
27 // Returns an instance of a Backend implemented only in memory. The returned 31 // Returns an instance of a Backend implemented only in memory. The returned
28 // object should be deleted when not needed anymore. max_bytes is the maximum 32 // object should be deleted when not needed anymore. max_bytes is the maximum
29 // size the cache can grow to. If zero is passed in as max_bytes, the cache 33 // size the cache can grow to. If zero is passed in as max_bytes, the cache
30 // will determine the value to use based on the available memory. The returned 34 // will determine the value to use based on the available memory. The returned
31 // pointer can be NULL if a fatal error is found. 35 // pointer can be NULL if a fatal error is found.
32 static Backend* CreateBackend(int max_bytes); 36 static Backend* CreateBackend(int max_bytes, net::NetLog* net_log);
33 37
34 // Performs general initialization for this current instance of the cache. 38 // Performs general initialization for this current instance of the cache.
35 bool Init(); 39 bool Init();
36 40
37 // Sets the maximum size for the total amount of data stored by this instance. 41 // Sets the maximum size for the total amount of data stored by this instance.
38 bool SetMaxSize(int max_bytes); 42 bool SetMaxSize(int max_bytes);
39 43
40 // Permanently deletes an entry. 44 // Permanently deletes an entry.
41 void InternalDoomEntry(MemEntryImpl* entry); 45 void InternalDoomEntry(MemEntryImpl* entry);
42 46
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 101
98 // Handles the used storage count. 102 // Handles the used storage count.
99 void AddStorageSize(int32 bytes); 103 void AddStorageSize(int32 bytes);
100 void SubstractStorageSize(int32 bytes); 104 void SubstractStorageSize(int32 bytes);
101 105
102 EntryMap entries_; 106 EntryMap entries_;
103 MemRankings rankings_; // Rankings to be able to trim the cache. 107 MemRankings rankings_; // Rankings to be able to trim the cache.
104 int32 max_size_; // Maximum data size for this instance. 108 int32 max_size_; // Maximum data size for this instance.
105 int32 current_size_; 109 int32 current_size_;
106 110
111 net::NetLog* net_log_;
112
107 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl); 113 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl);
108 }; 114 };
109 115
110 } // namespace disk_cache 116 } // namespace disk_cache
111 117
112 #endif // NET_DISK_CACHE_MEM_BACKEND_IMPL_H__ 118 #endif // NET_DISK_CACHE_MEM_BACKEND_IMPL_H__
OLDNEW
« no previous file with comments | « net/disk_cache/entry_impl.cc ('k') | net/disk_cache/mem_backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698