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

Side by Side Diff: webkit/fileapi/file_stream_writer.h

Issue 15859007: Move browser-specific FileAPI code from webkit/fileapi to webkit/browser/fileapi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dump_file_system build fix Created 7 years, 6 months 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
« no previous file with comments | « webkit/fileapi/file_permission_policy.cc ('k') | webkit/fileapi/file_system_context.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_FILEAPI_FILE_STREAM_WRITER_H_
6 #define WEBKIT_FILEAPI_FILE_STREAM_WRITER_H_
7
8 #include "base/basictypes.h"
9 #include "net/base/completion_callback.h"
10 #include "webkit/storage/webkit_storage_export.h"
11
12 namespace net {
13 class IOBuffer;
14 }
15
16 namespace fileapi {
17
18 // A generic interface for writing to a file-like object.
19 class WEBKIT_STORAGE_EXPORT_PRIVATE FileStreamWriter {
20 public:
21 // Closes the file. If there's an in-flight operation, it is canceled (i.e.,
22 // the callback function associated with the operation is not called).
23 virtual ~FileStreamWriter() {}
24
25 // Writes to the current cursor position asynchronously.
26 //
27 // Up to buf_len bytes will be written. (In other words, partial
28 // writes are allowed.) If the write completed synchronously, it returns
29 // the number of bytes written. If the operation could not be performed, it
30 // returns an error code. Otherwise, net::ERR_IO_PENDING is returned, and the
31 // callback will be run on the thread where Write() was called when the write
32 // has completed.
33 //
34 // This errors out (either synchronously or via callback) with:
35 // net::ERR_FILE_NOT_FOUND: When the target file is not found.
36 // net::ERR_ACCESS_DENIED: When the target file is a directory or
37 // the writer has no permission on the file.
38 // net::ERR_FILE_NO_SPACE: When the write will result in out of quota
39 // or there is not enough room left on the disk.
40 //
41 // It is invalid to call Write while there is an in-flight async operation.
42 virtual int Write(net::IOBuffer* buf, int buf_len,
43 const net::CompletionCallback& callback) = 0;
44
45 // Cancels an in-flight async operation.
46 //
47 // If the cancel is finished synchronously, it returns net::OK. If the
48 // cancel could not be performed, it returns an error code. Especially when
49 // there is no in-flight operation, net::ERR_UNEXPECTED is returned.
50 // Otherwise, net::ERR_IO_PENDING is returned, and the callback will be run on
51 // the thread where Cancel() was called when the cancel has completed. It is
52 // invalid to call Cancel() more than once on the same async operation.
53 //
54 // In either case, the callback function passed to the in-flight async
55 // operation is dismissed immediately when Cancel() is called, and thus
56 // will never be called.
57 virtual int Cancel(const net::CompletionCallback& callback) = 0;
58
59 // Flushes the data written so far.
60 //
61 // If the flush finished synchronously, it return net::OK. If the flush could
62 // not be performed, it returns an error code. Otherwise, net::ERR_IO_PENDING
63 // is returned, and the callback will be run on the thread where Flush() was
64 // called when the flush has completed.
65 //
66 // It is invalid to call Flush while there is an in-flight async operation.
67 virtual int Flush(const net::CompletionCallback& callback) = 0;
68 };
69
70 } // namespace fileapi
71
72 #endif // WEBKIT_FILEAPI_FILE_STREAM_WRITER_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_permission_policy.cc ('k') | webkit/fileapi/file_system_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698