| OLD | NEW |
| 1 // Copyright (c) 2009-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009-2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 class SparseControl { | 33 class SparseControl { |
| 34 public: | 34 public: |
| 35 // The operation to perform. | 35 // The operation to perform. |
| 36 enum SparseOperation { | 36 enum SparseOperation { |
| 37 kNoOperation, | 37 kNoOperation, |
| 38 kReadOperation, | 38 kReadOperation, |
| 39 kWriteOperation, | 39 kWriteOperation, |
| 40 kGetRangeOperation | 40 kGetRangeOperation |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 explicit SparseControl(EntryImpl* entry) | 43 explicit SparseControl(EntryImpl* entry); |
| 44 : entry_(entry), child_(NULL), operation_(kNoOperation), init_(false), | |
| 45 child_map_(child_data_.bitmap, kNumSparseBits, kNumSparseBits / 32), | |
| 46 ALLOW_THIS_IN_INITIALIZER_LIST( | |
| 47 child_callback_(this, &SparseControl::OnChildIOCompleted)), | |
| 48 user_callback_(NULL) {} | |
| 49 ~SparseControl(); | 44 ~SparseControl(); |
| 50 | 45 |
| 51 // Initializes the object for the current entry. If this entry already stores | 46 // Initializes the object for the current entry. If this entry already stores |
| 52 // sparse data, or can be used to do it, it updates the relevant information | 47 // sparse data, or can be used to do it, it updates the relevant information |
| 53 // on disk and returns net::OK. Otherwise it returns a net error code. | 48 // on disk and returns net::OK. Otherwise it returns a net error code. |
| 54 int Init(); | 49 int Init(); |
| 55 | 50 |
| 56 // Performs a quick test to see if the entry is sparse or not, without | 51 // Performs a quick test to see if the entry is sparse or not, without |
| 57 // generating disk IO (so the answer provided is only a best effort). | 52 // generating disk IO (so the answer provided is only a best effort). |
| 58 bool CouldBeSparse() const; | 53 bool CouldBeSparse() const; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 int child_offset_; // Offset to use for the current child. | 168 int child_offset_; // Offset to use for the current child. |
| 174 int child_len_; // Bytes to read or write for this child. | 169 int child_len_; // Bytes to read or write for this child. |
| 175 int result_; | 170 int result_; |
| 176 | 171 |
| 177 DISALLOW_COPY_AND_ASSIGN(SparseControl); | 172 DISALLOW_COPY_AND_ASSIGN(SparseControl); |
| 178 }; | 173 }; |
| 179 | 174 |
| 180 } // namespace disk_cache | 175 } // namespace disk_cache |
| 181 | 176 |
| 182 #endif // NET_DISK_CACHE_SPARSE_CONTROL_H_ | 177 #endif // NET_DISK_CACHE_SPARSE_CONTROL_H_ |
| OLD | NEW |