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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 void Seek(base::File::Whence whence, | 94 void Seek(base::File::Whence whence, |
95 int64 offset, | 95 int64 offset, |
96 const Int64CompletionCallback& callback); | 96 const Int64CompletionCallback& callback); |
97 | 97 |
98 void Flush(const CompletionCallback& callback); | 98 void Flush(const CompletionCallback& callback); |
99 | 99 |
100 private: | 100 private: |
101 struct IOResult { | 101 struct IOResult { |
102 IOResult(); | 102 IOResult(); |
103 IOResult(int64 result, int os_error); | 103 IOResult(int64 result, logging::SystemErrorCode os_error); |
104 static IOResult FromOSError(int64 os_error); | 104 static IOResult FromOSError(logging::SystemErrorCode os_error); |
105 | 105 |
106 int64 result; | 106 int64 result; |
107 int os_error; // Set only when result < 0. | 107 logging::SystemErrorCode os_error; // Set only when result < 0. |
108 }; | 108 }; |
109 | 109 |
110 struct OpenResult { | 110 struct OpenResult { |
111 MOVE_ONLY_TYPE_FOR_CPP_03(OpenResult, RValue) | 111 MOVE_ONLY_TYPE_FOR_CPP_03(OpenResult, RValue) |
112 public: | 112 public: |
113 OpenResult(); | 113 OpenResult(); |
114 OpenResult(base::File file, IOResult error_code); | 114 OpenResult(base::File file, IOResult error_code); |
115 // C++03 move emulation of this type. | 115 // C++03 move emulation of this type. |
116 OpenResult(RValue other); | 116 OpenResult(RValue other); |
117 OpenResult& operator=(RValue other); | 117 OpenResult& operator=(RValue other); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |