Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(963)

Side by Side Diff: webkit/chromeos/fileapi/async_file_stream.h

Issue 8907014: Implement async verision of FileSystemFileUtil and in-memory file system for testing purposes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove Read() and Write() from FileUtilAsync Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_CHROMEOS_FILEAPI_ASYNC_FILE_STREAM_H_
6 #define WEBKIT_CHROMEOS_FILEAPI_ASYNC_FILE_STREAM_H_
7
8 #include "base/platform_file.h"
9 #include "base/callback.h"
10
11 namespace fileapi {
12
13 using base::PlatformFileError;
14
15 // Abstract class similar to net::FileStream, but supporting only
16 // the asyncronous operations and not necessarily relying on PlatformFile.
17 class AsyncFileStream {
18 public:
19 // Used for Read() and Write(). |result| is the return code of the
20 // operation, and |length| is the length of data read or written.
21 typedef base::Callback<void(PlatformFileError result,
22 int64 length)> ReadWriteCallback;
23
24 // Used for Seek(). |result| is the return code of the operation.
25 typedef base::Callback<void(PlatformFileError)> SeekCallback;
26
27 virtual ~AsyncFileStream() {};
28
29 // Reads data from the current stream position. Up to |length| bytes
30 // will be read from |buffer|. The memory pointed to by |buffer| must
31 // remain valid until the callback is called.
32 virtual void Read(char* buffer,
33 int64 length,
34 const ReadWriteCallback& callback) = 0;
35
36 // Writes data at the current stream position. Up to |length| bytes will
37 // be written from |buffer|. The memory pointed to by |buffer| must
38 // remain valid until the callback is called.
39 virtual void Write(const char* buffer,
40 int64 length,
41 const ReadWriteCallback& callback) = 0;
42
43 virtual void Seek(int64 offset,
44 const SeekCallback& callback) = 0;
45 };
46
47 } // namespace fileapi
48
49 #endif // WEBKIT_CHROMEOS_FILEAPI_ASYNC_FILE_STREAM_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/chromeos/fileapi/file_util_async.h » ('j') | webkit/chromeos/fileapi/file_util_async.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698