OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_MEM_ENTRY_IMPL_H__ | 5 #ifndef NET_DISK_CACHE_MEM_ENTRY_IMPL_H__ |
6 #define NET_DISK_CACHE_MEM_ENTRY_IMPL_H__ | 6 #define NET_DISK_CACHE_MEM_ENTRY_IMPL_H__ |
7 | 7 |
8 #include "net/disk_cache/disk_cache.h" | 8 #include "net/disk_cache/disk_cache.h" |
9 | 9 |
10 namespace disk_cache { | 10 namespace disk_cache { |
11 | 11 |
12 class MemBackendImpl; | 12 class MemBackendImpl; |
13 | 13 |
14 // This class implements the Entry interface for the memory-only cache. An | 14 // This class implements the Entry interface for the memory-only cache. An |
15 // object of this class represents a single entry on the cache. | 15 // object of this class represents a single entry on the cache. |
16 class MemEntryImpl : public Entry { | 16 class MemEntryImpl : public Entry { |
17 public: | 17 public: |
18 explicit MemEntryImpl(MemBackendImpl* backend); | 18 explicit MemEntryImpl(MemBackendImpl* backend); |
19 | 19 |
20 // Entry interface. | 20 // Entry interface. |
21 virtual void Doom(); | 21 virtual void Doom(); |
22 virtual void Close(); | 22 virtual void Close(); |
23 virtual std::string GetKey() const; | 23 virtual std::string GetKey() const; |
24 virtual base::Time GetLastUsed() const; | 24 virtual base::Time GetLastUsed() const; |
25 virtual base::Time GetLastModified() const; | 25 virtual base::Time GetLastModified() const; |
26 virtual int32 GetDataSize(int index) const; | 26 virtual int32 GetDataSize(int index) const; |
27 virtual int ReadData(int index, int offset, char* buf, int buf_len, | 27 virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len, |
28 net::CompletionCallback* completion_callback); | 28 net::CompletionCallback* completion_callback); |
29 virtual int WriteData(int index, int offset, const char* buf, int buf_len, | 29 virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, |
30 net::CompletionCallback* completion_callback, | 30 net::CompletionCallback* completion_callback, |
31 bool truncate); | 31 bool truncate); |
32 | 32 |
33 // Performs the initialization of a EntryImpl that will be added to the | 33 // Performs the initialization of a EntryImpl that will be added to the |
34 // cache. | 34 // cache. |
35 bool CreateEntry(const std::string& key); | 35 bool CreateEntry(const std::string& key); |
36 | 36 |
37 // Permamently destroys this entry | 37 // Permamently destroys this entry |
38 void InternalDoom(); | 38 void InternalDoom(); |
39 | 39 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 MemBackendImpl* backend_; // Back pointer to the cache. | 81 MemBackendImpl* backend_; // Back pointer to the cache. |
82 bool doomed_; // True if this entry was removed from the cache. | 82 bool doomed_; // True if this entry was removed from the cache. |
83 | 83 |
84 DISALLOW_EVIL_CONSTRUCTORS(MemEntryImpl); | 84 DISALLOW_EVIL_CONSTRUCTORS(MemEntryImpl); |
85 }; | 85 }; |
86 | 86 |
87 } // namespace disk_cache | 87 } // namespace disk_cache |
88 | 88 |
89 #endif // NET_DISK_CACHE_MEM_ENTRY_IMPL_H__ | 89 #endif // NET_DISK_CACHE_MEM_ENTRY_IMPL_H__ |
90 | 90 |
OLD | NEW |