| 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 // This file defines FileStream::Context class. | 5 // This file defines FileStream::Context class. |
| 6 // The general design of FileStream is as follows: file_stream.h defines | 6 // The general design of FileStream is as follows: file_stream.h defines |
| 7 // FileStream class which basically is just an "wrapper" not containing any | 7 // FileStream class which basically is just an "wrapper" not containing any |
| 8 // specific implementation details. It re-routes all its method calls to | 8 // specific implementation details. It re-routes all its method calls to |
| 9 // the instance of FileStream::Context (FileStream holds a scoped_ptr to | 9 // the instance of FileStream::Context (FileStream holds a scoped_ptr to |
| 10 // FileStream::Context instance). Context was extracted into a different class | 10 // FileStream::Context instance). Context was extracted into a different class |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 //////////////////////////////////////////////////////////////////////////// | 58 //////////////////////////////////////////////////////////////////////////// |
| 59 | 59 |
| 60 explicit Context(const scoped_refptr<base::TaskRunner>& task_runner); | 60 explicit Context(const scoped_refptr<base::TaskRunner>& task_runner); |
| 61 Context(base::File file, const scoped_refptr<base::TaskRunner>& task_runner); | 61 Context(base::File file, const scoped_refptr<base::TaskRunner>& task_runner); |
| 62 #if defined(OS_WIN) | 62 #if defined(OS_WIN) |
| 63 virtual ~Context(); | 63 virtual ~Context(); |
| 64 #elif defined(OS_POSIX) | 64 #elif defined(OS_POSIX) |
| 65 ~Context(); | 65 ~Context(); |
| 66 #endif | 66 #endif |
| 67 | 67 |
| 68 int Read(IOBuffer* buf, | 68 int Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback); |
| 69 int buf_len, | |
| 70 const CompletionCallback& callback); | |
| 71 | 69 |
| 72 int Write(IOBuffer* buf, | 70 int Write(IOBuffer* buf, int buf_len, const CompletionCallback& callback); |
| 73 int buf_len, | |
| 74 const CompletionCallback& callback); | |
| 75 | 71 |
| 76 const base::File& file() const { return file_; } | 72 const base::File& file() const { return file_; } |
| 77 bool async_in_progress() const { return async_in_progress_; } | 73 bool async_in_progress() const { return async_in_progress_; } |
| 78 | 74 |
| 79 //////////////////////////////////////////////////////////////////////////// | 75 //////////////////////////////////////////////////////////////////////////// |
| 80 // Platform-independent methods implemented in file_stream_context.cc. | 76 // Platform-independent methods implemented in file_stream_context.cc. |
| 81 //////////////////////////////////////////////////////////////////////////// | 77 //////////////////////////////////////////////////////////////////////////// |
| 82 | 78 |
| 83 // Destroys the context. It can be deleted in the method or deletion can be | 79 // Destroys the context. It can be deleted in the method or deletion can be |
| 84 // deferred if some asynchronous operation is now in progress or if file is | 80 // deferred if some asynchronous operation is now in progress or if file is |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 CompletionCallback callback_; | 176 CompletionCallback callback_; |
| 181 scoped_refptr<IOBuffer> in_flight_buf_; | 177 scoped_refptr<IOBuffer> in_flight_buf_; |
| 182 #endif | 178 #endif |
| 183 | 179 |
| 184 DISALLOW_COPY_AND_ASSIGN(Context); | 180 DISALLOW_COPY_AND_ASSIGN(Context); |
| 185 }; | 181 }; |
| 186 | 182 |
| 187 } // namespace net | 183 } // namespace net |
| 188 | 184 |
| 189 #endif // NET_BASE_FILE_STREAM_CONTEXT_H_ | 185 #endif // NET_BASE_FILE_STREAM_CONTEXT_H_ |
| OLD | NEW |