| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_SIMPLE_SIMPLE_ENTRY_IMPL_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
| 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 int CreateEntry(Entry** entry, const CompletionCallback& callback); | 73 int CreateEntry(Entry** entry, const CompletionCallback& callback); |
| 74 | 74 |
| 75 // Identical to Backend::Doom() except that it accepts a CompletionCallback. | 75 // Identical to Backend::Doom() except that it accepts a CompletionCallback. |
| 76 int DoomEntry(const CompletionCallback& callback); | 76 int DoomEntry(const CompletionCallback& callback); |
| 77 | 77 |
| 78 const std::string& key() const { return key_; } | 78 const std::string& key() const { return key_; } |
| 79 uint64 entry_hash() const { return entry_hash_; } | 79 uint64 entry_hash() const { return entry_hash_; } |
| 80 void SetKey(const std::string& key); | 80 void SetKey(const std::string& key); |
| 81 | 81 |
| 82 // From Entry: | 82 // From Entry: |
| 83 virtual void Doom() OVERRIDE; | 83 virtual void Doom() override; |
| 84 virtual void Close() OVERRIDE; | 84 virtual void Close() override; |
| 85 virtual std::string GetKey() const OVERRIDE; | 85 virtual std::string GetKey() const override; |
| 86 virtual base::Time GetLastUsed() const OVERRIDE; | 86 virtual base::Time GetLastUsed() const override; |
| 87 virtual base::Time GetLastModified() const OVERRIDE; | 87 virtual base::Time GetLastModified() const override; |
| 88 virtual int32 GetDataSize(int index) const OVERRIDE; | 88 virtual int32 GetDataSize(int index) const override; |
| 89 virtual int ReadData(int stream_index, | 89 virtual int ReadData(int stream_index, |
| 90 int offset, | 90 int offset, |
| 91 net::IOBuffer* buf, | 91 net::IOBuffer* buf, |
| 92 int buf_len, | 92 int buf_len, |
| 93 const CompletionCallback& callback) OVERRIDE; | 93 const CompletionCallback& callback) override; |
| 94 virtual int WriteData(int stream_index, | 94 virtual int WriteData(int stream_index, |
| 95 int offset, | 95 int offset, |
| 96 net::IOBuffer* buf, | 96 net::IOBuffer* buf, |
| 97 int buf_len, | 97 int buf_len, |
| 98 const CompletionCallback& callback, | 98 const CompletionCallback& callback, |
| 99 bool truncate) OVERRIDE; | 99 bool truncate) override; |
| 100 virtual int ReadSparseData(int64 offset, | 100 virtual int ReadSparseData(int64 offset, |
| 101 net::IOBuffer* buf, | 101 net::IOBuffer* buf, |
| 102 int buf_len, | 102 int buf_len, |
| 103 const CompletionCallback& callback) OVERRIDE; | 103 const CompletionCallback& callback) override; |
| 104 virtual int WriteSparseData(int64 offset, | 104 virtual int WriteSparseData(int64 offset, |
| 105 net::IOBuffer* buf, | 105 net::IOBuffer* buf, |
| 106 int buf_len, | 106 int buf_len, |
| 107 const CompletionCallback& callback) OVERRIDE; | 107 const CompletionCallback& callback) override; |
| 108 virtual int GetAvailableRange(int64 offset, | 108 virtual int GetAvailableRange(int64 offset, |
| 109 int len, | 109 int len, |
| 110 int64* start, | 110 int64* start, |
| 111 const CompletionCallback& callback) OVERRIDE; | 111 const CompletionCallback& callback) override; |
| 112 virtual bool CouldBeSparse() const OVERRIDE; | 112 virtual bool CouldBeSparse() const override; |
| 113 virtual void CancelSparseIO() OVERRIDE; | 113 virtual void CancelSparseIO() override; |
| 114 virtual int ReadyForSparseIO(const CompletionCallback& callback) OVERRIDE; | 114 virtual int ReadyForSparseIO(const CompletionCallback& callback) override; |
| 115 | 115 |
| 116 private: | 116 private: |
| 117 class ScopedOperationRunner; | 117 class ScopedOperationRunner; |
| 118 friend class ScopedOperationRunner; | 118 friend class ScopedOperationRunner; |
| 119 | 119 |
| 120 enum State { | 120 enum State { |
| 121 // The state immediately after construction, but before |synchronous_entry_| | 121 // The state immediately after construction, but before |synchronous_entry_| |
| 122 // has been assigned. This is the state at construction, and is the only | 122 // has been assigned. This is the state at construction, and is the only |
| 123 // legal state to destruct an entry in. | 123 // legal state to destruct an entry in. |
| 124 STATE_UNINITIALIZED, | 124 STATE_UNINITIALIZED, |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 // 1 on disk, to reduce the number of file descriptors and save disk space. | 370 // 1 on disk, to reduce the number of file descriptors and save disk space. |
| 371 // This strategy allows stream 1 to change size easily. Since stream 0 is only | 371 // This strategy allows stream 1 to change size easily. Since stream 0 is only |
| 372 // used to write HTTP headers, the memory consumption of keeping it in memory | 372 // used to write HTTP headers, the memory consumption of keeping it in memory |
| 373 // is acceptable. | 373 // is acceptable. |
| 374 scoped_refptr<net::GrowableIOBuffer> stream_0_data_; | 374 scoped_refptr<net::GrowableIOBuffer> stream_0_data_; |
| 375 }; | 375 }; |
| 376 | 376 |
| 377 } // namespace disk_cache | 377 } // namespace disk_cache |
| 378 | 378 |
| 379 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ | 379 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
| OLD | NEW |