| 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, a basic interface for reading and writing files | 5 // This file defines FileStream, a basic interface for reading and writing files | 
| 6 // synchronously or asynchronously with support for seeking to an offset. | 6 // synchronously or asynchronously with support for seeking to an offset. | 
| 7 // Note that even when used asynchronously, only one operation is supported at | 7 // Note that even when used asynchronously, only one operation is supported at | 
| 8 // a time. | 8 // a time. | 
| 9 | 9 | 
| 10 #ifndef NET_BASE_FILE_STREAM_H_ | 10 #ifndef NET_BASE_FILE_STREAM_H_ | 
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 74 | 74 | 
| 75   // Call this method to open the FileStream synchronously. | 75   // Call this method to open the FileStream synchronously. | 
| 76   // The remaining methods cannot be used unless this method returns OK.  If | 76   // The remaining methods cannot be used unless this method returns OK.  If | 
| 77   // the file cannot be opened then an error code is returned.  open_flags is | 77   // the file cannot be opened then an error code is returned.  open_flags is | 
| 78   // a bitfield of base::PlatformFileFlags | 78   // a bitfield of base::PlatformFileFlags | 
| 79   // | 79   // | 
| 80   // If the file stream is not closed manually, the underlying file will be | 80   // If the file stream is not closed manually, the underlying file will be | 
| 81   // automatically closed when FileStream is destructed. | 81   // automatically closed when FileStream is destructed. | 
| 82   virtual int OpenSync(const base::FilePath& path, int open_flags); | 82   virtual int OpenSync(const base::FilePath& path, int open_flags); | 
| 83 | 83 | 
|  | 84   // Returns ERR_IO_PENDING and closes the file asynchronously, calling | 
|  | 85   // |callback| when done. | 
|  | 86   virtual int Close(const CompletionCallback& callback); | 
|  | 87 | 
|  | 88   // Closes the file immediately and returns OK. If the file is open | 
|  | 89   // asynchronously, Close(const CompletionCallback&) should be used instead. | 
|  | 90   virtual int CloseSync(); | 
|  | 91 | 
| 84   // Returns true if Open succeeded and Close has not been called. | 92   // Returns true if Open succeeded and Close has not been called. | 
| 85   virtual bool IsOpen() const; | 93   virtual bool IsOpen() const; | 
| 86 | 94 | 
| 87   // Adjust the position from where data is read asynchronously. | 95   // Adjust the position from where data is read asynchronously. | 
| 88   // Upon success, ERR_IO_PENDING is returned and |callback| will be run | 96   // Upon success, ERR_IO_PENDING is returned and |callback| will be run | 
| 89   // on the thread where Seek() was called with the the stream position | 97   // on the thread where Seek() was called with the the stream position | 
| 90   // relative to the start of the file.  Otherwise, an error code is returned. | 98   // relative to the start of the file.  Otherwise, an error code is returned. | 
| 91   // It is invalid to request any asynchronous operations while there is an | 99   // It is invalid to request any asynchronous operations while there is an | 
| 92   // in-flight asynchronous operation. | 100   // in-flight asynchronous operation. | 
| 93   virtual int Seek(Whence whence, int64 offset, | 101   virtual int Seek(Whence whence, int64 offset, | 
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 246   // delaying FileStream's destructor. To perform all that separate object is | 254   // delaying FileStream's destructor. To perform all that separate object is | 
| 247   // necessary. | 255   // necessary. | 
| 248   scoped_ptr<Context> context_; | 256   scoped_ptr<Context> context_; | 
| 249 | 257 | 
| 250   DISALLOW_COPY_AND_ASSIGN(FileStream); | 258   DISALLOW_COPY_AND_ASSIGN(FileStream); | 
| 251 }; | 259 }; | 
| 252 | 260 | 
| 253 }  // namespace net | 261 }  // namespace net | 
| 254 | 262 | 
| 255 #endif  // NET_BASE_FILE_STREAM_H_ | 263 #endif  // NET_BASE_FILE_STREAM_H_ | 
| OLD | NEW | 
|---|