OLD | NEW |
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 #include "net/disk_cache/blockfile/sparse_control.h" | 5 #include "net/disk_cache/blockfile/sparse_control.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
11 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
13 #include "base/time/time.h" | 15 #include "base/time/time.h" |
14 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
15 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
16 #include "net/disk_cache/blockfile/backend_impl.h" | 18 #include "net/disk_cache/blockfile/backend_impl.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 DCHECK(init_); | 248 DCHECK(init_); |
247 // We don't support simultaneous IO for sparse data. | 249 // We don't support simultaneous IO for sparse data. |
248 if (operation_ != kNoOperation) | 250 if (operation_ != kNoOperation) |
249 return net::ERR_CACHE_OPERATION_NOT_SUPPORTED; | 251 return net::ERR_CACHE_OPERATION_NOT_SUPPORTED; |
250 | 252 |
251 if (offset < 0 || buf_len < 0) | 253 if (offset < 0 || buf_len < 0) |
252 return net::ERR_INVALID_ARGUMENT; | 254 return net::ERR_INVALID_ARGUMENT; |
253 | 255 |
254 // We only support up to 64 GB. | 256 // We only support up to 64 GB. |
255 if (static_cast<uint64>(offset) + static_cast<unsigned int>(buf_len) >= | 257 if (static_cast<uint64>(offset) + static_cast<unsigned int>(buf_len) >= |
256 GG_UINT64_C(0x1000000000)) { | 258 UINT64_C(0x1000000000)) { |
257 return net::ERR_CACHE_OPERATION_NOT_SUPPORTED; | 259 return net::ERR_CACHE_OPERATION_NOT_SUPPORTED; |
258 } | 260 } |
259 | 261 |
260 DCHECK(!user_buf_.get()); | 262 DCHECK(!user_buf_.get()); |
261 DCHECK(user_callback_.is_null()); | 263 DCHECK(user_callback_.is_null()); |
262 | 264 |
263 if (!buf && (op == kReadOperation || op == kWriteOperation)) | 265 if (!buf && (op == kReadOperation || op == kWriteOperation)) |
264 return 0; | 266 return 0; |
265 | 267 |
266 // Copy the operation parameters. | 268 // Copy the operation parameters. |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 CompletionCallback cb = abort_callbacks_[i]; | 894 CompletionCallback cb = abort_callbacks_[i]; |
893 if (i == abort_callbacks_.size() - 1) | 895 if (i == abort_callbacks_.size() - 1) |
894 abort_callbacks_.clear(); | 896 abort_callbacks_.clear(); |
895 | 897 |
896 entry_->Release(); // Don't touch object after this line. | 898 entry_->Release(); // Don't touch object after this line. |
897 cb.Run(net::OK); | 899 cb.Run(net::OK); |
898 } | 900 } |
899 } | 901 } |
900 | 902 |
901 } // namespace disk_cache | 903 } // namespace disk_cache |
OLD | NEW |