| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // Destroys the context. It can be deleted in the method or deletion can be | 100 // Destroys the context. It can be deleted in the method or deletion can be |
| 101 // deferred if some asynchronous operation is now in progress or if file is | 101 // deferred if some asynchronous operation is now in progress or if file is |
| 102 // not closed yet. | 102 // not closed yet. |
| 103 void Orphan(); | 103 void Orphan(); |
| 104 | 104 |
| 105 void OpenAsync(const base::FilePath& path, | 105 void OpenAsync(const base::FilePath& path, |
| 106 int open_flags, | 106 int open_flags, |
| 107 const CompletionCallback& callback); | 107 const CompletionCallback& callback); |
| 108 int OpenSync(const base::FilePath& path, int open_flags); | 108 int OpenSync(const base::FilePath& path, int open_flags); |
| 109 | 109 |
| 110 #if defined(OS_ANDROID) |
| 111 void OpenContentUrlAsync(const base::FilePath& path, |
| 112 int open_flags, |
| 113 const CompletionCallback& callback); |
| 114 int OpenContentUrlSync(const base::FilePath& path, int open_flags); |
| 115 #endif |
| 116 |
| 110 void CloseSync(); | 117 void CloseSync(); |
| 111 | 118 |
| 112 void CloseAsync(const CompletionCallback& callback); | 119 void CloseAsync(const CompletionCallback& callback); |
| 113 | 120 |
| 114 void SeekAsync(Whence whence, | 121 void SeekAsync(Whence whence, |
| 115 int64 offset, | 122 int64 offset, |
| 116 const Int64CompletionCallback& callback); | 123 const Int64CompletionCallback& callback); |
| 117 int64 SeekSync(Whence whence, int64 offset); | 124 int64 SeekSync(Whence whence, int64 offset); |
| 118 | 125 |
| 119 void FlushAsync(const CompletionCallback& callback); | 126 void FlushAsync(const CompletionCallback& callback); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 139 base::PlatformFile file; | 146 base::PlatformFile file; |
| 140 IOResult error_code; | 147 IOResult error_code; |
| 141 }; | 148 }; |
| 142 | 149 |
| 143 // Log the error from |result| to |bound_net_log_|. | 150 // Log the error from |result| to |bound_net_log_|. |
| 144 void RecordError(const IOResult& result, FileErrorSource source) const; | 151 void RecordError(const IOResult& result, FileErrorSource source) const; |
| 145 | 152 |
| 146 void BeginOpenEvent(const base::FilePath& path); | 153 void BeginOpenEvent(const base::FilePath& path); |
| 147 | 154 |
| 148 OpenResult OpenFileImpl(const base::FilePath& path, int open_flags); | 155 OpenResult OpenFileImpl(const base::FilePath& path, int open_flags); |
| 156 #if defined(OS_ANDROID) |
| 157 OpenResult OpenContentUrlImpl(const base::FilePath& path, int open_flags); |
| 158 #endif |
| 149 | 159 |
| 150 void ProcessOpenError(const IOResult& result); | 160 void ProcessOpenError(const IOResult& result); |
| 151 void OnOpenCompleted(const CompletionCallback& callback, | 161 void OnOpenCompleted(const CompletionCallback& callback, |
| 152 OpenResult open_result); | 162 OpenResult open_result); |
| 153 | 163 |
| 154 void CloseAndDelete(); | 164 void CloseAndDelete(); |
| 155 void OnCloseCompleted(); | 165 void OnCloseCompleted(); |
| 156 | 166 |
| 157 Int64CompletionCallback IntToInt64(const CompletionCallback& callback); | 167 Int64CompletionCallback IntToInt64(const CompletionCallback& callback); |
| 158 | 168 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 FileErrorSource error_source_; | 238 FileErrorSource error_source_; |
| 229 #endif | 239 #endif |
| 230 | 240 |
| 231 DISALLOW_COPY_AND_ASSIGN(Context); | 241 DISALLOW_COPY_AND_ASSIGN(Context); |
| 232 }; | 242 }; |
| 233 | 243 |
| 234 } // namespace net | 244 } // namespace net |
| 235 | 245 |
| 236 #endif // NET_BASE_FILE_STREAM_CONTEXT_H_ | 246 #endif // NET_BASE_FILE_STREAM_CONTEXT_H_ |
| 237 | 247 |
| OLD | NEW |