| 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/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/profiler/scoped_tracker.h" | 10 #include "base/profiler/scoped_tracker.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 callback.Run(static_cast<int>(result)); | 26 callback.Run(static_cast<int>(result)); |
| 27 } | 27 } |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 FileStream::Context::IOResult::IOResult() | 31 FileStream::Context::IOResult::IOResult() |
| 32 : result(OK), | 32 : result(OK), |
| 33 os_error(0) { | 33 os_error(0) { |
| 34 } | 34 } |
| 35 | 35 |
| 36 FileStream::Context::IOResult::IOResult(int64 result, int os_error) | 36 FileStream::Context::IOResult::IOResult(int64 result, |
| 37 logging::SystemErrorCode os_error) |
| 37 : result(result), | 38 : result(result), |
| 38 os_error(os_error) { | 39 os_error(os_error) { |
| 39 } | 40 } |
| 40 | 41 |
| 41 // static | 42 // static |
| 42 FileStream::Context::IOResult FileStream::Context::IOResult::FromOSError( | 43 FileStream::Context::IOResult FileStream::Context::IOResult::FromOSError( |
| 43 int64 os_error) { | 44 logging::SystemErrorCode os_error) { |
| 44 return IOResult(MapSystemError(os_error), os_error); | 45 return IOResult(MapSystemError(os_error), os_error); |
| 45 } | 46 } |
| 46 | 47 |
| 47 // --------------------------------------------------------------------- | 48 // --------------------------------------------------------------------- |
| 48 | 49 |
| 49 FileStream::Context::OpenResult::OpenResult() { | 50 FileStream::Context::OpenResult::OpenResult() { |
| 50 } | 51 } |
| 51 | 52 |
| 52 FileStream::Context::OpenResult::OpenResult(base::File file, | 53 FileStream::Context::OpenResult::OpenResult(base::File file, |
| 53 IOResult error_code) | 54 IOResult error_code) |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 // should be reset before Close() because it shouldn't run if any async | 240 // should be reset before Close() because it shouldn't run if any async |
| 240 // operation is in progress. | 241 // operation is in progress. |
| 241 async_in_progress_ = false; | 242 async_in_progress_ = false; |
| 242 if (orphaned_) | 243 if (orphaned_) |
| 243 CloseAndDelete(); | 244 CloseAndDelete(); |
| 244 else | 245 else |
| 245 callback.Run(result.result); | 246 callback.Run(result.result); |
| 246 } | 247 } |
| 247 | 248 |
| 248 } // namespace net | 249 } // namespace net |
| OLD | NEW |