Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_FILEAPI_ASYNC_FILE_STREAM_H_ | |
| 6 #define WEBKIT_FILEAPI_ASYNC_FILE_STREAM_H_ | |
|
kinuko
2011/12/14 03:39:22
nit: needs to be updated as well (to add CHROMEOS_
satorux1
2011/12/14 04:43:26
Done.
| |
| 7 | |
| 8 #include "base/platform_file.h" | |
| 9 #include "base/callback.h" | |
| 10 | |
| 11 namespace fileapi { | |
| 12 | |
| 13 using base::PlatformFileError; | |
| 14 | |
| 15 typedef base::Callback<void(PlatformFileError, int64)> ReadWriteCallback; | |
| 16 typedef base::Callback<void(PlatformFileError)> StatusCallback; | |
| 17 | |
| 18 // Abstract class similar to net::FileStream, but supporting only | |
| 19 // the asyncronous operations and not necessarily relying on PlatformFile. | |
| 20 class AsyncFileStream { | |
| 21 public: | |
| 22 virtual ~AsyncFileStream() {}; | |
| 23 | |
| 24 virtual void Read(char* buffer, | |
| 25 int64 length, | |
| 26 const ReadWriteCallback& callback) = 0; | |
|
satorux1
2011/12/14 05:19:55
The API looks error-prone. The caller needs to mai
satorux1
2011/12/14 06:55:17
I take it back. We could design an API that does n
| |
| 27 | |
| 28 virtual void Write(const char* buffer, | |
| 29 int64 length, | |
| 30 const ReadWriteCallback& callback) = 0; | |
| 31 | |
| 32 virtual void Seek(int64 offset, | |
| 33 const StatusCallback& callback) = 0; | |
| 34 }; | |
| 35 | |
| 36 } // namespace fileapi | |
| 37 | |
| 38 #endif // WEBKIT_FILEAPI_ASYNC_FILE_STREAM_H_ | |
| OLD | NEW |