| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/file.h" | 5 #include "net/disk_cache/blockfile/file.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| 11 #include <utility> |
| 11 | 12 |
| 12 #include "base/bind.h" | 13 #include "base/bind.h" |
| 13 #include "base/location.h" | 14 #include "base/location.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/threading/worker_pool.h" | 17 #include "base/threading/worker_pool.h" |
| 17 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 18 #include "net/disk_cache/blockfile/in_flight_io.h" | 19 #include "net/disk_cache/blockfile/in_flight_io.h" |
| 19 #include "net/disk_cache/disk_cache.h" | 20 #include "net/disk_cache/disk_cache.h" |
| 20 | 21 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 DCHECK(s_file_operations); | 167 DCHECK(s_file_operations); |
| 167 delete s_file_operations; | 168 delete s_file_operations; |
| 168 s_file_operations = NULL; | 169 s_file_operations = NULL; |
| 169 } | 170 } |
| 170 | 171 |
| 171 } // namespace | 172 } // namespace |
| 172 | 173 |
| 173 namespace disk_cache { | 174 namespace disk_cache { |
| 174 | 175 |
| 175 File::File(base::File file) | 176 File::File(base::File file) |
| 176 : init_(true), | 177 : init_(true), mixed_(true), base_file_(std::move(file)) {} |
| 177 mixed_(true), | |
| 178 base_file_(file.Pass()) { | |
| 179 } | |
| 180 | 178 |
| 181 bool File::Init(const base::FilePath& name) { | 179 bool File::Init(const base::FilePath& name) { |
| 182 if (base_file_.IsValid()) | 180 if (base_file_.IsValid()) |
| 183 return false; | 181 return false; |
| 184 | 182 |
| 185 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ | | 183 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ | |
| 186 base::File::FLAG_WRITE; | 184 base::File::FLAG_WRITE; |
| 187 base_file_.Initialize(name, flags); | 185 base_file_.Initialize(name, flags); |
| 188 return base_file_.IsValid(); | 186 return base_file_.IsValid(); |
| 189 } | 187 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 return false; | 292 return false; |
| 295 | 293 |
| 296 GetFileInFlightIO()->PostWrite(this, buffer, buffer_len, offset, callback); | 294 GetFileInFlightIO()->PostWrite(this, buffer, buffer_len, offset, callback); |
| 297 | 295 |
| 298 if (completed) | 296 if (completed) |
| 299 *completed = false; | 297 *completed = false; |
| 300 return true; | 298 return true; |
| 301 } | 299 } |
| 302 | 300 |
| 303 } // namespace disk_cache | 301 } // namespace disk_cache |
| OLD | NEW |