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

Side by Side Diff: net/disk_cache/blockfile/entry_impl.h

Issue 1499423004: Remove kint32max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kint9
Patch Set: rebase 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/blockfile/backend_worker_v3.cc ('k') | net/disk_cache/blockfile/entry_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 #ifndef NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_H_ 5 #ifndef NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_H_
6 #define NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_H_ 6 #define NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_H_
7 7
8 #include <stdint.h>
9
8 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
9 #include "net/disk_cache/blockfile/disk_format.h" 11 #include "net/disk_cache/blockfile/disk_format.h"
10 #include "net/disk_cache/blockfile/storage_block-inl.h" 12 #include "net/disk_cache/blockfile/storage_block-inl.h"
11 #include "net/disk_cache/blockfile/storage_block.h" 13 #include "net/disk_cache/blockfile/storage_block.h"
12 #include "net/disk_cache/disk_cache.h" 14 #include "net/disk_cache/disk_cache.h"
13 #include "net/log/net_log.h" 15 #include "net/log/net_log.h"
14 16
15 namespace disk_cache { 17 namespace disk_cache {
16 18
17 class BackendImpl; 19 class BackendImpl;
(...skipping 21 matching lines...) Expand all
39 }; 41 };
40 42
41 EntryImpl(BackendImpl* backend, Addr address, bool read_only); 43 EntryImpl(BackendImpl* backend, Addr address, bool read_only);
42 44
43 // Background implementation of the Entry interface. 45 // Background implementation of the Entry interface.
44 void DoomImpl(); 46 void DoomImpl();
45 int ReadDataImpl(int index, int offset, IOBuffer* buf, int buf_len, 47 int ReadDataImpl(int index, int offset, IOBuffer* buf, int buf_len,
46 const CompletionCallback& callback); 48 const CompletionCallback& callback);
47 int WriteDataImpl(int index, int offset, IOBuffer* buf, int buf_len, 49 int WriteDataImpl(int index, int offset, IOBuffer* buf, int buf_len,
48 const CompletionCallback& callback, bool truncate); 50 const CompletionCallback& callback, bool truncate);
49 int ReadSparseDataImpl(int64 offset, IOBuffer* buf, int buf_len, 51 int ReadSparseDataImpl(int64_t offset,
52 IOBuffer* buf,
53 int buf_len,
50 const CompletionCallback& callback); 54 const CompletionCallback& callback);
51 int WriteSparseDataImpl(int64 offset, IOBuffer* buf, int buf_len, 55 int WriteSparseDataImpl(int64_t offset,
56 IOBuffer* buf,
57 int buf_len,
52 const CompletionCallback& callback); 58 const CompletionCallback& callback);
53 int GetAvailableRangeImpl(int64 offset, int len, int64* start); 59 int GetAvailableRangeImpl(int64_t offset, int len, int64_t* start);
54 void CancelSparseIOImpl(); 60 void CancelSparseIOImpl();
55 int ReadyForSparseIOImpl(const CompletionCallback& callback); 61 int ReadyForSparseIOImpl(const CompletionCallback& callback);
56 62
57 inline CacheEntryBlock* entry() { 63 inline CacheEntryBlock* entry() {
58 return &entry_; 64 return &entry_;
59 } 65 }
60 66
61 inline CacheRankingsBlock* rankings() { 67 inline CacheRankingsBlock* rankings() {
62 return &node_; 68 return &node_;
63 } 69 }
64 70
65 uint32 GetHash(); 71 uint32_t GetHash();
66 72
67 // Performs the initialization of a EntryImpl that will be added to the 73 // Performs the initialization of a EntryImpl that will be added to the
68 // cache. 74 // cache.
69 bool CreateEntry(Addr node_address, const std::string& key, uint32 hash); 75 bool CreateEntry(Addr node_address, const std::string& key, uint32_t hash);
70 76
71 // Returns true if this entry matches the lookup arguments. 77 // Returns true if this entry matches the lookup arguments.
72 bool IsSameEntry(const std::string& key, uint32 hash); 78 bool IsSameEntry(const std::string& key, uint32_t hash);
73 79
74 // Permamently destroys this entry. 80 // Permamently destroys this entry.
75 void InternalDoom(); 81 void InternalDoom();
76 82
77 // Deletes this entry from disk. If |everything| is false, only the user data 83 // Deletes this entry from disk. If |everything| is false, only the user data
78 // will be removed, leaving the key and control data intact. 84 // will be removed, leaving the key and control data intact.
79 void DeleteEntryData(bool everything); 85 void DeleteEntryData(bool everything);
80 86
81 // Returns the address of the next entry on the list of entries with the same 87 // Returns the address of the next entry on the list of entries with the same
82 // hash. 88 // hash.
(...skipping 14 matching lines...) Expand all
97 bool dirty() { 103 bool dirty() {
98 return dirty_; 104 return dirty_;
99 } 105 }
100 106
101 bool doomed() { 107 bool doomed() {
102 return doomed_; 108 return doomed_;
103 } 109 }
104 110
105 // Marks this entry as dirty (in memory) if needed. This is intended only for 111 // Marks this entry as dirty (in memory) if needed. This is intended only for
106 // entries that are being read from disk, to be called during loading. 112 // entries that are being read from disk, to be called during loading.
107 void SetDirtyFlag(int32 current_id); 113 void SetDirtyFlag(int32_t current_id);
108 114
109 // Fixes this entry so it can be treated as valid (to delete it). 115 // Fixes this entry so it can be treated as valid (to delete it).
110 void SetPointerForInvalidEntry(int32 new_id); 116 void SetPointerForInvalidEntry(int32_t new_id);
111 117
112 // Returns true if this entry is so meesed up that not everything is going to 118 // Returns true if this entry is so meesed up that not everything is going to
113 // be removed. 119 // be removed.
114 bool LeaveRankingsBehind(); 120 bool LeaveRankingsBehind();
115 121
116 // Returns false if the entry is clearly invalid. 122 // Returns false if the entry is clearly invalid.
117 bool SanityCheck(); 123 bool SanityCheck();
118 bool DataSanityCheck(); 124 bool DataSanityCheck();
119 125
120 // Attempts to make this entry reachable though the key. 126 // Attempts to make this entry reachable though the key.
(...skipping 24 matching lines...) Expand all
145 151
146 // Returns the number of blocks needed to store an EntryStore. 152 // Returns the number of blocks needed to store an EntryStore.
147 static int NumBlocksForEntry(int key_size); 153 static int NumBlocksForEntry(int key_size);
148 154
149 // Entry interface. 155 // Entry interface.
150 void Doom() override; 156 void Doom() override;
151 void Close() override; 157 void Close() override;
152 std::string GetKey() const override; 158 std::string GetKey() const override;
153 base::Time GetLastUsed() const override; 159 base::Time GetLastUsed() const override;
154 base::Time GetLastModified() const override; 160 base::Time GetLastModified() const override;
155 int32 GetDataSize(int index) const override; 161 int32_t GetDataSize(int index) const override;
156 int ReadData(int index, 162 int ReadData(int index,
157 int offset, 163 int offset,
158 IOBuffer* buf, 164 IOBuffer* buf,
159 int buf_len, 165 int buf_len,
160 const CompletionCallback& callback) override; 166 const CompletionCallback& callback) override;
161 int WriteData(int index, 167 int WriteData(int index,
162 int offset, 168 int offset,
163 IOBuffer* buf, 169 IOBuffer* buf,
164 int buf_len, 170 int buf_len,
165 const CompletionCallback& callback, 171 const CompletionCallback& callback,
166 bool truncate) override; 172 bool truncate) override;
167 int ReadSparseData(int64 offset, 173 int ReadSparseData(int64_t offset,
168 IOBuffer* buf, 174 IOBuffer* buf,
169 int buf_len, 175 int buf_len,
170 const CompletionCallback& callback) override; 176 const CompletionCallback& callback) override;
171 int WriteSparseData(int64 offset, 177 int WriteSparseData(int64_t offset,
172 IOBuffer* buf, 178 IOBuffer* buf,
173 int buf_len, 179 int buf_len,
174 const CompletionCallback& callback) override; 180 const CompletionCallback& callback) override;
175 int GetAvailableRange(int64 offset, 181 int GetAvailableRange(int64_t offset,
176 int len, 182 int len,
177 int64* start, 183 int64_t* start,
178 const CompletionCallback& callback) override; 184 const CompletionCallback& callback) override;
179 bool CouldBeSparse() const override; 185 bool CouldBeSparse() const override;
180 void CancelSparseIO() override; 186 void CancelSparseIO() override;
181 int ReadyForSparseIO(const CompletionCallback& callback) override; 187 int ReadyForSparseIO(const CompletionCallback& callback) override;
182 188
183 private: 189 private:
184 enum { 190 enum {
185 kNumStreams = 3 191 kNumStreams = 3
186 }; 192 };
187 class UserBuffer; 193 class UserBuffer;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // is determined based on the current data length and |min_len|. 247 // is determined based on the current data length and |min_len|.
242 bool Flush(int index, int min_len); 248 bool Flush(int index, int min_len);
243 249
244 // Updates the size of a given data stream. 250 // Updates the size of a given data stream.
245 void UpdateSize(int index, int old_size, int new_size); 251 void UpdateSize(int index, int old_size, int new_size);
246 252
247 // Initializes the sparse control object. Returns a net error code. 253 // Initializes the sparse control object. Returns a net error code.
248 int InitSparseData(); 254 int InitSparseData();
249 255
250 // Adds the provided |flags| to the current EntryFlags for this entry. 256 // Adds the provided |flags| to the current EntryFlags for this entry.
251 void SetEntryFlags(uint32 flags); 257 void SetEntryFlags(uint32_t flags);
252 258
253 // Returns the current EntryFlags for this entry. 259 // Returns the current EntryFlags for this entry.
254 uint32 GetEntryFlags(); 260 uint32_t GetEntryFlags();
255 261
256 // Gets the data stored at the given index. If the information is in memory, 262 // Gets the data stored at the given index. If the information is in memory,
257 // a buffer will be allocated and the data will be copied to it (the caller 263 // a buffer will be allocated and the data will be copied to it (the caller
258 // can find out the size of the buffer before making this call). Otherwise, 264 // can find out the size of the buffer before making this call). Otherwise,
259 // the cache address of the data will be returned, and that address will be 265 // the cache address of the data will be returned, and that address will be
260 // removed from the regular book keeping of this entry so the caller is 266 // removed from the regular book keeping of this entry so the caller is
261 // responsible for deleting the block (or file) from the backing store at some 267 // responsible for deleting the block (or file) from the backing store at some
262 // point; there is no need to report any storage-size change, only to do the 268 // point; there is no need to report any storage-size change, only to do the
263 // actual cleanup. 269 // actual cleanup.
264 void GetData(int index, char** buffer, Addr* address); 270 void GetData(int index, char** buffer, Addr* address);
(...skipping 16 matching lines...) Expand all
281 scoped_ptr<SparseControl> sparse_; // Support for sparse entries. 287 scoped_ptr<SparseControl> sparse_; // Support for sparse entries.
282 288
283 net::BoundNetLog net_log_; 289 net::BoundNetLog net_log_;
284 290
285 DISALLOW_COPY_AND_ASSIGN(EntryImpl); 291 DISALLOW_COPY_AND_ASSIGN(EntryImpl);
286 }; 292 };
287 293
288 } // namespace disk_cache 294 } // namespace disk_cache
289 295
290 #endif // NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_H_ 296 #endif // NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_H_
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/backend_worker_v3.cc ('k') | net/disk_cache/blockfile/entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698