| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_SPARSE_CONTROL_H_ | 5 #ifndef NET_DISK_CACHE_SPARSE_CONTROL_H_ |
| 6 #define NET_DISK_CACHE_SPARSE_CONTROL_H_ | 6 #define NET_DISK_CACHE_SPARSE_CONTROL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // |buf_len| specify the actual data to use and |callback| is the callback | 56 // |buf_len| specify the actual data to use and |callback| is the callback |
| 57 // to use for asynchronous operations. See the description of the Read / | 57 // to use for asynchronous operations. See the description of the Read / |
| 58 // WriteSparseData for details about the arguments. The return value is the | 58 // WriteSparseData for details about the arguments. The return value is the |
| 59 // number of bytes read or written, or a net error code. | 59 // number of bytes read or written, or a net error code. |
| 60 int StartIO(SparseOperation op, int64 offset, net::IOBuffer* buf, | 60 int StartIO(SparseOperation op, int64 offset, net::IOBuffer* buf, |
| 61 int buf_len, net::CompletionCallback* callback); | 61 int buf_len, net::CompletionCallback* callback); |
| 62 | 62 |
| 63 // Implements Entry::GetAvailableRange(). | 63 // Implements Entry::GetAvailableRange(). |
| 64 int GetAvailableRange(int64 offset, int len, int64* start); | 64 int GetAvailableRange(int64 offset, int len, int64* start); |
| 65 | 65 |
| 66 // Deletes the children entries of |entry|. |
| 67 static void DeleteChildren(EntryImpl* entry); |
| 68 |
| 66 private: | 69 private: |
| 67 // Creates a new sparse entry or opens an aready created entry from disk. | 70 // Creates a new sparse entry or opens an aready created entry from disk. |
| 68 // These methods just read / write the required info from disk for the current | 71 // These methods just read / write the required info from disk for the current |
| 69 // entry, and verify that everything is correct. The return value is a net | 72 // entry, and verify that everything is correct. The return value is a net |
| 70 // error code. | 73 // error code. |
| 71 int CreateSparseEntry(); | 74 int CreateSparseEntry(); |
| 72 int OpenSparseEntry(int data_len); | 75 int OpenSparseEntry(int data_len); |
| 73 | 76 |
| 74 // Opens and closes a child entry. A child entry is a regular EntryImpl object | 77 // Opens and closes a child entry. A child entry is a regular EntryImpl object |
| 75 // with a key derived from the key of the resource to store and the range | 78 // with a key derived from the key of the resource to store and the range |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 int child_offset_; // Offset to use for the current child. | 146 int child_offset_; // Offset to use for the current child. |
| 144 int child_len_; // Bytes to read or write for this child. | 147 int child_len_; // Bytes to read or write for this child. |
| 145 int result_; | 148 int result_; |
| 146 | 149 |
| 147 DISALLOW_COPY_AND_ASSIGN(SparseControl); | 150 DISALLOW_COPY_AND_ASSIGN(SparseControl); |
| 148 }; | 151 }; |
| 149 | 152 |
| 150 } // namespace disk_cache | 153 } // namespace disk_cache |
| 151 | 154 |
| 152 #endif // NET_DISK_CACHE_SPARSE_CONTROL_H_ | 155 #endif // NET_DISK_CACHE_SPARSE_CONTROL_H_ |
| OLD | NEW |