| 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 <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/posix/eintr_wrapper.h" | 17 #include "base/posix/eintr_wrapper.h" |
| 18 #include "base/task_runner.h" | 18 #include "base/task_runner.h" |
| 19 #include "base/task_runner_util.h" | 19 #include "base/task_runner_util.h" |
| 20 #include "net/base/io_buffer.h" | 20 #include "net/base/io_buffer.h" |
| 21 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
| 22 | 22 |
| 23 namespace net { | 23 namespace net { |
| 24 | 24 |
| 25 FileStream::Context::Context(const scoped_refptr<base::TaskRunner>& task_runner) | 25 FileStream::Context::Context(const scoped_refptr<base::TaskRunner>& task_runner) |
| 26 : async_in_progress_(false), | 26 : async_in_progress_(false), orphaned_(false), task_runner_(task_runner) { |
| 27 orphaned_(false), | |
| 28 task_runner_(task_runner) { | |
| 29 } | 27 } |
| 30 | 28 |
| 31 FileStream::Context::Context(base::File file, | 29 FileStream::Context::Context(base::File file, |
| 32 const scoped_refptr<base::TaskRunner>& task_runner) | 30 const scoped_refptr<base::TaskRunner>& task_runner) |
| 33 : file_(file.Pass()), | 31 : file_(file.Pass()), |
| 34 async_in_progress_(false), | 32 async_in_progress_(false), |
| 35 orphaned_(false), | 33 orphaned_(false), |
| 36 task_runner_(task_runner) { | 34 task_runner_(task_runner) { |
| 37 } | 35 } |
| 38 | 36 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 scoped_refptr<IOBuffer> buf, | 102 scoped_refptr<IOBuffer> buf, |
| 105 int buf_len) { | 103 int buf_len) { |
| 106 int res = file_.WriteAtCurrentPosNoBestEffort(buf->data(), buf_len); | 104 int res = file_.WriteAtCurrentPosNoBestEffort(buf->data(), buf_len); |
| 107 if (res == -1) | 105 if (res == -1) |
| 108 return IOResult::FromOSError(errno); | 106 return IOResult::FromOSError(errno); |
| 109 | 107 |
| 110 return IOResult(res, 0); | 108 return IOResult(res, 0); |
| 111 } | 109 } |
| 112 | 110 |
| 113 } // namespace net | 111 } // namespace net |
| OLD | NEW |