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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 struct IOResult { | 103 struct IOResult { |
104 IOResult(); | 104 IOResult(); |
105 IOResult(int64_t result, logging::SystemErrorCode os_error); | 105 IOResult(int64_t result, logging::SystemErrorCode os_error); |
106 static IOResult FromOSError(logging::SystemErrorCode os_error); | 106 static IOResult FromOSError(logging::SystemErrorCode os_error); |
107 | 107 |
108 int64_t result; | 108 int64_t result; |
109 logging::SystemErrorCode os_error; // Set only when result < 0. | 109 logging::SystemErrorCode os_error; // Set only when result < 0. |
110 }; | 110 }; |
111 | 111 |
112 struct OpenResult { | 112 struct OpenResult { |
113 MOVE_ONLY_TYPE_FOR_CPP_03(OpenResult, RValue) | 113 MOVE_ONLY_TYPE_FOR_CPP_03(OpenResult) |
114 public: | 114 public: |
115 OpenResult(); | 115 OpenResult(); |
116 OpenResult(base::File file, IOResult error_code); | 116 OpenResult(base::File file, IOResult error_code); |
117 // C++03 move emulation of this type. | 117 OpenResult(OpenResult&& other); |
118 OpenResult(RValue other); | 118 OpenResult& operator=(OpenResult&& other); |
119 OpenResult& operator=(RValue other); | |
120 | 119 |
121 base::File file; | 120 base::File file; |
122 IOResult error_code; | 121 IOResult error_code; |
123 }; | 122 }; |
124 | 123 |
125 //////////////////////////////////////////////////////////////////////////// | 124 //////////////////////////////////////////////////////////////////////////// |
126 // Platform-independent methods implemented in file_stream_context.cc. | 125 // Platform-independent methods implemented in file_stream_context.cc. |
127 //////////////////////////////////////////////////////////////////////////// | 126 //////////////////////////////////////////////////////////////////////////// |
128 | 127 |
129 OpenResult OpenFileImpl(const base::FilePath& path, int open_flags); | 128 OpenResult OpenFileImpl(const base::FilePath& path, int open_flags); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // Tracks the result of the IO completion operation. Set in OnIOComplete. | 233 // Tracks the result of the IO completion operation. Set in OnIOComplete. |
235 int result_; | 234 int result_; |
236 #endif | 235 #endif |
237 | 236 |
238 DISALLOW_COPY_AND_ASSIGN(Context); | 237 DISALLOW_COPY_AND_ASSIGN(Context); |
239 }; | 238 }; |
240 | 239 |
241 } // namespace net | 240 } // namespace net |
242 | 241 |
243 #endif // NET_BASE_FILE_STREAM_CONTEXT_H_ | 242 #endif // NET_BASE_FILE_STREAM_CONTEXT_H_ |
OLD | NEW |