Chromium Code Reviews| 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/base/file_stream_context.h" | 5 #include "net/base/file_stream_context.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "base/task_runner.h" | 10 #include "base/task_runner.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 | 47 |
| 48 FileStream::Context::OpenResult::OpenResult() { | 48 FileStream::Context::OpenResult::OpenResult() { |
| 49 } | 49 } |
| 50 | 50 |
| 51 FileStream::Context::OpenResult::OpenResult(base::File file, | 51 FileStream::Context::OpenResult::OpenResult(base::File file, |
| 52 IOResult error_code) | 52 IOResult error_code) |
| 53 : file(file.Pass()), | 53 : file(file.Pass()), |
| 54 error_code(error_code) { | 54 error_code(error_code) { |
| 55 } | 55 } |
| 56 | 56 |
| 57 FileStream::Context::OpenResult::OpenResult(RValue other) | 57 FileStream::Context::OpenResult::OpenResult(OpenResult&& other) |
| 58 : file(other.object->file.Pass()), | 58 : file(other.file.Pass()), error_code(other.error_code) {} |
| 59 error_code(other.object->error_code) { | |
| 60 } | |
| 61 | 59 |
| 62 FileStream::Context::OpenResult& FileStream::Context::OpenResult::operator=( | 60 FileStream::Context::OpenResult& FileStream::Context::OpenResult::operator=( |
| 63 RValue other) { | 61 OpenResult&& other) { |
| 64 if (this != other.object) { | 62 DCHECK_NE(this, &other); |
|
danakj
2015/10/15 23:35:06
also not destructive, remove?
dcheng
2015/10/16 00:40:01
See above.
dcheng
2015/10/19 21:29:50
Done.
| |
| 65 file = other.object->file.Pass(); | 63 file = other.file.Pass(); |
| 66 error_code = other.object->error_code; | 64 error_code = other.error_code; |
| 67 } | |
| 68 return *this; | 65 return *this; |
| 69 } | 66 } |
| 70 | 67 |
| 71 // --------------------------------------------------------------------- | 68 // --------------------------------------------------------------------- |
| 72 | 69 |
| 73 void FileStream::Context::Orphan() { | 70 void FileStream::Context::Orphan() { |
| 74 DCHECK(!orphaned_); | 71 DCHECK(!orphaned_); |
| 75 | 72 |
| 76 orphaned_ = true; | 73 orphaned_ = true; |
| 77 | 74 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 // should be reset before Close() because it shouldn't run if any async | 230 // should be reset before Close() because it shouldn't run if any async |
| 234 // operation is in progress. | 231 // operation is in progress. |
| 235 async_in_progress_ = false; | 232 async_in_progress_ = false; |
| 236 if (orphaned_) | 233 if (orphaned_) |
| 237 CloseAndDelete(); | 234 CloseAndDelete(); |
| 238 else | 235 else |
| 239 callback.Run(result.result); | 236 callback.Run(result.result); |
| 240 } | 237 } |
| 241 | 238 |
| 242 } // namespace net | 239 } // namespace net |
| OLD | NEW |