OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 // Forces out a filesystem sync on this file to make sure that the file was | 124 // Forces out a filesystem sync on this file to make sure that the file was |
125 // written out to disk and is not currently sitting in the buffer. This does | 125 // written out to disk and is not currently sitting in the buffer. This does |
126 // not have to be called, it just forces one to happen at the time of | 126 // not have to be called, it just forces one to happen at the time of |
127 // calling. | 127 // calling. |
128 // | 128 // |
129 /// Returns an error code if the operation could not be performed. | 129 /// Returns an error code if the operation could not be performed. |
130 // | 130 // |
131 // This method should not be called if the stream was opened READ_ONLY. | 131 // This method should not be called if the stream was opened READ_ONLY. |
132 int Flush(); | 132 int Flush(); |
| 133 |
133 private: | 134 private: |
134 class AsyncContext; | 135 class AsyncContext; |
135 friend class AsyncContext; | 136 friend class AsyncContext; |
136 | 137 |
137 // This member is used to support asynchronous reads. It is non-null when | 138 // This member is used to support asynchronous reads. It is non-null when |
138 // the FileStream was opened with PLATFORM_FILE_ASYNC. | 139 // the FileStream was opened with PLATFORM_FILE_ASYNC. |
139 scoped_ptr<AsyncContext> async_context_; | 140 scoped_ptr<AsyncContext> async_context_; |
140 | 141 |
141 base::PlatformFile file_; | 142 base::PlatformFile file_; |
142 int open_flags_; | 143 int open_flags_; |
143 bool auto_closed_; | 144 bool auto_closed_; |
144 | 145 |
145 DISALLOW_COPY_AND_ASSIGN(FileStream); | 146 DISALLOW_COPY_AND_ASSIGN(FileStream); |
146 }; | 147 }; |
147 | 148 |
148 } // namespace net | 149 } // namespace net |
149 | 150 |
150 #endif // NET_BASE_FILE_STREAM_H_ | 151 #endif // NET_BASE_FILE_STREAM_H_ |
OLD | NEW |