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

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

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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
« no previous file with comments | « net/disk_cache/entry_unittest.cc ('k') | net/disk_cache/memory/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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_MEMORY_MEM_BACKEND_IMPL_H_ 7 #ifndef NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_
8 #define NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_ 8 #define NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_
9 9
10 #include <stdint.h>
11
10 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
11 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
13 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
14 #include "net/disk_cache/disk_cache.h" 17 #include "net/disk_cache/disk_cache.h"
15 #include "net/disk_cache/memory/mem_rankings.h" 18 #include "net/disk_cache/memory/mem_rankings.h"
16 19
17 namespace net { 20 namespace net {
18 class NetLog; 21 class NetLog;
19 } // namespace net 22 } // namespace net
20 23
21 namespace disk_cache { 24 namespace disk_cache {
(...skipping 20 matching lines...) Expand all
42 // Sets the maximum size for the total amount of data stored by this instance. 45 // Sets the maximum size for the total amount of data stored by this instance.
43 bool SetMaxSize(int max_bytes); 46 bool SetMaxSize(int max_bytes);
44 47
45 // Permanently deletes an entry. 48 // Permanently deletes an entry.
46 void InternalDoomEntry(MemEntryImpl* entry); 49 void InternalDoomEntry(MemEntryImpl* entry);
47 50
48 // Updates the ranking information for an entry. 51 // Updates the ranking information for an entry.
49 void UpdateRank(MemEntryImpl* node); 52 void UpdateRank(MemEntryImpl* node);
50 53
51 // A user data block is being created, extended or truncated. 54 // A user data block is being created, extended or truncated.
52 void ModifyStorageSize(int32 old_size, int32 new_size); 55 void ModifyStorageSize(int32_t old_size, int32_t new_size);
53 56
54 // Returns the maximum size for a file to reside on the cache. 57 // Returns the maximum size for a file to reside on the cache.
55 int MaxFileSize() const; 58 int MaxFileSize() const;
56 59
57 // Insert an MemEntryImpl into the ranking list. This method is only called 60 // Insert an MemEntryImpl into the ranking list. This method is only called
58 // from MemEntryImpl to insert child entries. The reference can be removed 61 // from MemEntryImpl to insert child entries. The reference can be removed
59 // by calling RemoveFromRankingList(|entry|). 62 // by calling RemoveFromRankingList(|entry|).
60 void InsertIntoRankingList(MemEntryImpl* entry); 63 void InsertIntoRankingList(MemEntryImpl* entry);
61 64
62 // Remove |entry| from ranking list. This method is only called from 65 // Remove |entry| from ranking list. This method is only called from
63 // MemEntryImpl to remove a child entry from the ranking list. 66 // MemEntryImpl to remove a child entry from the ranking list.
64 void RemoveFromRankingList(MemEntryImpl* entry); 67 void RemoveFromRankingList(MemEntryImpl* entry);
65 68
66 // Backend interface. 69 // Backend interface.
67 net::CacheType GetCacheType() const override; 70 net::CacheType GetCacheType() const override;
68 int32 GetEntryCount() const override; 71 int32_t GetEntryCount() const override;
69 int OpenEntry(const std::string& key, 72 int OpenEntry(const std::string& key,
70 Entry** entry, 73 Entry** entry,
71 const CompletionCallback& callback) override; 74 const CompletionCallback& callback) override;
72 int CreateEntry(const std::string& key, 75 int CreateEntry(const std::string& key,
73 Entry** entry, 76 Entry** entry,
74 const CompletionCallback& callback) override; 77 const CompletionCallback& callback) override;
75 int DoomEntry(const std::string& key, 78 int DoomEntry(const std::string& key,
76 const CompletionCallback& callback) override; 79 const CompletionCallback& callback) override;
77 int DoomAllEntries(const CompletionCallback& callback) override; 80 int DoomAllEntries(const CompletionCallback& callback) override;
78 int DoomEntriesBetween(base::Time initial_time, 81 int DoomEntriesBetween(base::Time initial_time,
(...skipping 20 matching lines...) Expand all
99 bool DoomEntriesBetween(const base::Time initial_time, 102 bool DoomEntriesBetween(const base::Time initial_time,
100 const base::Time end_time); 103 const base::Time end_time);
101 bool DoomEntriesSince(const base::Time initial_time); 104 bool DoomEntriesSince(const base::Time initial_time);
102 105
103 // Deletes entries from the cache until the current size is below the limit. 106 // Deletes entries from the cache until the current size is below the limit.
104 // If empty is true, the whole cache will be trimmed, regardless of being in 107 // If empty is true, the whole cache will be trimmed, regardless of being in
105 // use. 108 // use.
106 void TrimCache(bool empty); 109 void TrimCache(bool empty);
107 110
108 // Handles the used storage count. 111 // Handles the used storage count.
109 void AddStorageSize(int32 bytes); 112 void AddStorageSize(int32_t bytes);
110 void SubstractStorageSize(int32 bytes); 113 void SubstractStorageSize(int32_t bytes);
111 114
112 EntryMap entries_; 115 EntryMap entries_;
113 MemRankings rankings_; // Rankings to be able to trim the cache. 116 MemRankings rankings_; // Rankings to be able to trim the cache.
114 int32 max_size_; // Maximum data size for this instance. 117 int32_t max_size_; // Maximum data size for this instance.
115 int32 current_size_; 118 int32_t current_size_;
116 119
117 net::NetLog* net_log_; 120 net::NetLog* net_log_;
118 121
119 base::WeakPtrFactory<MemBackendImpl> weak_factory_; 122 base::WeakPtrFactory<MemBackendImpl> weak_factory_;
120 123
121 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl); 124 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl);
122 }; 125 };
123 126
124 } // namespace disk_cache 127 } // namespace disk_cache
125 128
126 #endif // NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_ 129 #endif // NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_
OLDNEW
« no previous file with comments | « net/disk_cache/entry_unittest.cc ('k') | net/disk_cache/memory/mem_backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698