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

Side by Side Diff: net/disk_cache/blockfile/entry_impl_v3.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/entry_impl.cc ('k') | net/disk_cache/blockfile/entry_impl_v3.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_V3_H_ 5 #ifndef NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_V3_H_
6 #define NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_V3_H_ 6 #define NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_V3_H_
7 7
8 #include <stdint.h>
9
8 #include <string> 10 #include <string>
9 11
10 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
11 #include "net/disk_cache/blockfile/disk_format_v3.h" 13 #include "net/disk_cache/blockfile/disk_format_v3.h"
12 #include "net/disk_cache/blockfile/storage_block.h" 14 #include "net/disk_cache/blockfile/storage_block.h"
13 #include "net/disk_cache/disk_cache.h" 15 #include "net/disk_cache/disk_cache.h"
14 #include "net/log/net_log.h" 16 #include "net/log/net_log.h"
15 17
16 namespace disk_cache { 18 namespace disk_cache {
17 19
(...skipping 15 matching lines...) Expand all
33 kSparseWrite, 35 kSparseWrite,
34 kAsyncIO, 36 kAsyncIO,
35 kReadAsync1, 37 kReadAsync1,
36 kWriteAsync1 38 kWriteAsync1
37 }; 39 };
38 40
39 EntryImplV3(BackendImplV3* backend, Addr address, bool read_only); 41 EntryImplV3(BackendImplV3* backend, Addr address, bool read_only);
40 42
41 // Performs the initialization of a EntryImplV3 that will be added to the 43 // Performs the initialization of a EntryImplV3 that will be added to the
42 // cache. 44 // cache.
43 bool CreateEntry(Addr node_address, const std::string& key, uint32 hash); 45 bool CreateEntry(Addr node_address, const std::string& key, uint32_t hash);
44 46
45 uint32 GetHash(); 47 uint32_t GetHash();
46 48
47 uint32 GetHash() const; 49 uint32_t GetHash() const;
48 Addr GetAddress() const; 50 Addr GetAddress() const;
49 int GetReuseCounter() const; 51 int GetReuseCounter() const;
50 void SetReuseCounter(int count); 52 void SetReuseCounter(int count);
51 int GetRefetchCounter() const; 53 int GetRefetchCounter() const;
52 void SetRefetchCounter(int count); 54 void SetRefetchCounter(int count);
53 55
54 // Returns true if this entry matches the lookup arguments. 56 // Returns true if this entry matches the lookup arguments.
55 bool IsSameEntry(const std::string& key, uint32 hash); 57 bool IsSameEntry(const std::string& key, uint32_t hash);
56 58
57 // Permamently destroys this entry. 59 // Permamently destroys this entry.
58 void InternalDoom(); 60 void InternalDoom();
59 61
60 // Returns false if the entry is clearly invalid. 62 // Returns false if the entry is clearly invalid.
61 bool SanityCheck(); 63 bool SanityCheck();
62 bool DataSanityCheck(); 64 bool DataSanityCheck();
63 65
64 // Attempts to make this entry reachable though the key. 66 // Attempts to make this entry reachable though the key.
65 void FixForDelete(); 67 void FixForDelete();
66 68
67 // Set the access times for this entry. This method provides support for 69 // Set the access times for this entry. This method provides support for
68 // the upgrade tool. 70 // the upgrade tool.
69 void SetTimes(base::Time last_used, base::Time last_modified); 71 void SetTimes(base::Time last_used, base::Time last_modified);
70 72
71 // Logs a begin event and enables logging for the EntryImplV3. Will also cause 73 // Logs a begin event and enables logging for the EntryImplV3. Will also cause
72 // an end event to be logged on destruction. The EntryImplV3 must have its key 74 // an end event to be logged on destruction. The EntryImplV3 must have its key
73 // initialized before this is called. |created| is true if the Entry was 75 // initialized before this is called. |created| is true if the Entry was
74 // created rather than opened. 76 // created rather than opened.
75 void BeginLogging(net::NetLog* net_log, bool created); 77 void BeginLogging(net::NetLog* net_log, bool created);
76 78
77 const net::BoundNetLog& net_log() const; 79 const net::BoundNetLog& net_log() const;
78 80
79 // Entry interface. 81 // Entry interface.
80 void Doom() override; 82 void Doom() override;
81 void Close() override; 83 void Close() override;
82 std::string GetKey() const override; 84 std::string GetKey() const override;
83 base::Time GetLastUsed() const override; 85 base::Time GetLastUsed() const override;
84 base::Time GetLastModified() const override; 86 base::Time GetLastModified() const override;
85 int32 GetDataSize(int index) const override; 87 int32_t GetDataSize(int index) const override;
86 int ReadData(int index, 88 int ReadData(int index,
87 int offset, 89 int offset,
88 IOBuffer* buf, 90 IOBuffer* buf,
89 int buf_len, 91 int buf_len,
90 const CompletionCallback& callback) override; 92 const CompletionCallback& callback) override;
91 int WriteData(int index, 93 int WriteData(int index,
92 int offset, 94 int offset,
93 IOBuffer* buf, 95 IOBuffer* buf,
94 int buf_len, 96 int buf_len,
95 const CompletionCallback& callback, 97 const CompletionCallback& callback,
96 bool truncate) override; 98 bool truncate) override;
97 int ReadSparseData(int64 offset, 99 int ReadSparseData(int64_t offset,
98 IOBuffer* buf, 100 IOBuffer* buf,
99 int buf_len, 101 int buf_len,
100 const CompletionCallback& callback) override; 102 const CompletionCallback& callback) override;
101 int WriteSparseData(int64 offset, 103 int WriteSparseData(int64_t offset,
102 IOBuffer* buf, 104 IOBuffer* buf,
103 int buf_len, 105 int buf_len,
104 const CompletionCallback& callback) override; 106 const CompletionCallback& callback) override;
105 int GetAvailableRange(int64 offset, 107 int GetAvailableRange(int64_t offset,
106 int len, 108 int len,
107 int64* start, 109 int64_t* start,
108 const CompletionCallback& callback) override; 110 const CompletionCallback& callback) override;
109 bool CouldBeSparse() const override; 111 bool CouldBeSparse() const override;
110 void CancelSparseIO() override; 112 void CancelSparseIO() override;
111 int ReadyForSparseIO(const CompletionCallback& callback) override; 113 int ReadyForSparseIO(const CompletionCallback& callback) override;
112 114
113 private: 115 private:
114 enum { 116 enum {
115 kNumStreams = 3 117 kNumStreams = 3
116 }; 118 };
117 class UserBuffer; 119 class UserBuffer;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // is determined based on the current data length and |min_len|. 171 // is determined based on the current data length and |min_len|.
170 bool Flush(int index, int min_len); 172 bool Flush(int index, int min_len);
171 173
172 // Updates the size of a given data stream. 174 // Updates the size of a given data stream.
173 void UpdateSize(int index, int old_size, int new_size); 175 void UpdateSize(int index, int old_size, int new_size);
174 176
175 // Initializes the sparse control object. Returns a net error code. 177 // Initializes the sparse control object. Returns a net error code.
176 int InitSparseData(); 178 int InitSparseData();
177 179
178 // Adds the provided |flags| to the current EntryFlags for this entry. 180 // Adds the provided |flags| to the current EntryFlags for this entry.
179 void SetEntryFlags(uint32 flags); 181 void SetEntryFlags(uint32_t flags);
180 182
181 // Returns the current EntryFlags for this entry. 183 // Returns the current EntryFlags for this entry.
182 uint32 GetEntryFlags(); 184 uint32_t GetEntryFlags();
183 185
184 // Gets the data stored at the given index. If the information is in memory, 186 // Gets the data stored at the given index. If the information is in memory,
185 // a buffer will be allocated and the data will be copied to it (the caller 187 // a buffer will be allocated and the data will be copied to it (the caller
186 // can find out the size of the buffer before making this call). Otherwise, 188 // can find out the size of the buffer before making this call). Otherwise,
187 // the cache address of the data will be returned, and that address will be 189 // the cache address of the data will be returned, and that address will be
188 // removed from the regular book keeping of this entry so the caller is 190 // removed from the regular book keeping of this entry so the caller is
189 // responsible for deleting the block (or file) from the backing store at some 191 // responsible for deleting the block (or file) from the backing store at some
190 // point; there is no need to report any storage-size change, only to do the 192 // point; there is no need to report any storage-size change, only to do the
191 // actual cleanup. 193 // actual cleanup.
192 void GetData(int index, char** buffer, Addr* address); 194 void GetData(int index, char** buffer, Addr* address);
(...skipping 18 matching lines...) Expand all
211 // scoped_ptr<SparseControlV3> sparse_; // Support for sparse entries. 213 // scoped_ptr<SparseControlV3> sparse_; // Support for sparse entries.
212 214
213 net::BoundNetLog net_log_; 215 net::BoundNetLog net_log_;
214 216
215 DISALLOW_COPY_AND_ASSIGN(EntryImplV3); 217 DISALLOW_COPY_AND_ASSIGN(EntryImplV3);
216 }; 218 };
217 219
218 } // namespace disk_cache 220 } // namespace disk_cache
219 221
220 #endif // NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_V3_H_ 222 #endif // NET_DISK_CACHE_BLOCKFILE_ENTRY_IMPL_V3_H_
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/entry_impl.cc ('k') | net/disk_cache/blockfile/entry_impl_v3.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698