| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 151   IOResult SeekFileImpl(base::File::Whence whence, int64 offset); | 151   IOResult SeekFileImpl(base::File::Whence whence, int64 offset); | 
| 152 | 152 | 
| 153   void OnFileOpened(); | 153   void OnFileOpened(); | 
| 154 | 154 | 
| 155 #if defined(OS_WIN) | 155 #if defined(OS_WIN) | 
| 156   void IOCompletionIsPending(const CompletionCallback& callback, IOBuffer* buf); | 156   void IOCompletionIsPending(const CompletionCallback& callback, IOBuffer* buf); | 
| 157 | 157 | 
| 158   // Implementation of MessageLoopForIO::IOHandler. | 158   // Implementation of MessageLoopForIO::IOHandler. | 
| 159   virtual void OnIOCompleted(base::MessageLoopForIO::IOContext* context, | 159   virtual void OnIOCompleted(base::MessageLoopForIO::IOContext* context, | 
| 160                              DWORD bytes_read, | 160                              DWORD bytes_read, | 
| 161                              DWORD error) OVERRIDE; | 161                              DWORD error) override; | 
| 162 #elif defined(OS_POSIX) | 162 #elif defined(OS_POSIX) | 
| 163   // ReadFileImpl() is a simple wrapper around read() that handles EINTR | 163   // ReadFileImpl() is a simple wrapper around read() that handles EINTR | 
| 164   // signals and calls RecordAndMapError() to map errno to net error codes. | 164   // signals and calls RecordAndMapError() to map errno to net error codes. | 
| 165   IOResult ReadFileImpl(scoped_refptr<IOBuffer> buf, int buf_len); | 165   IOResult ReadFileImpl(scoped_refptr<IOBuffer> buf, int buf_len); | 
| 166 | 166 | 
| 167   // WriteFileImpl() is a simple wrapper around write() that handles EINTR | 167   // WriteFileImpl() is a simple wrapper around write() that handles EINTR | 
| 168   // signals and calls MapSystemError() to map errno to net error codes. | 168   // signals and calls MapSystemError() to map errno to net error codes. | 
| 169   // It tries to write to completion. | 169   // It tries to write to completion. | 
| 170   IOResult WriteFileImpl(scoped_refptr<IOBuffer> buf, int buf_len); | 170   IOResult WriteFileImpl(scoped_refptr<IOBuffer> buf, int buf_len); | 
| 171 #endif | 171 #endif | 
| 172 | 172 | 
| 173   base::File file_; | 173   base::File file_; | 
| 174   bool async_in_progress_; | 174   bool async_in_progress_; | 
| 175   bool orphaned_; | 175   bool orphaned_; | 
| 176   scoped_refptr<base::TaskRunner> task_runner_; | 176   scoped_refptr<base::TaskRunner> task_runner_; | 
| 177 | 177 | 
| 178 #if defined(OS_WIN) | 178 #if defined(OS_WIN) | 
| 179   base::MessageLoopForIO::IOContext io_context_; | 179   base::MessageLoopForIO::IOContext io_context_; | 
| 180   CompletionCallback callback_; | 180   CompletionCallback callback_; | 
| 181   scoped_refptr<IOBuffer> in_flight_buf_; | 181   scoped_refptr<IOBuffer> in_flight_buf_; | 
| 182 #endif | 182 #endif | 
| 183 | 183 | 
| 184   DISALLOW_COPY_AND_ASSIGN(Context); | 184   DISALLOW_COPY_AND_ASSIGN(Context); | 
| 185 }; | 185 }; | 
| 186 | 186 | 
| 187 }  // namespace net | 187 }  // namespace net | 
| 188 | 188 | 
| 189 #endif  // NET_BASE_FILE_STREAM_CONTEXT_H_ | 189 #endif  // NET_BASE_FILE_STREAM_CONTEXT_H_ | 
| OLD | NEW | 
|---|