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

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

Issue 10126004: fileapi: FileWriter and LocalFileWriter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: First working version. Created 8 years, 8 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 | « no previous file | webkit/fileapi/local_file_writer.h » ('j') | webkit/fileapi/local_file_writer.h » ('J')
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_WRITER_H_
6 #define WEBKIT_FILEAPI_FILE_WRITER_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "net/base/completion_callback.h"
11 #include "net/base/net_errors.h"
12
13 namespace net {
14 class IOBuffer;
15 }
16
17 namespace fileapi {
18
19 // A generic interface for writing to a file-like object.
20 class FileWriter {
21 public:
22 // Cancels the in-flight operation (if any) and closes.
kinuko 2012/04/20 11:26:37 This comment sounds like inconsistent from what we
kinaba 2012/04/23 08:56:41 Adjusted the LocalFileWriter's implementation.
23 virtual ~FileWriter() {}
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 // It is invalid to call Write while there is an in-flight async operation.
35 virtual int Write(net::IOBuffer* buf, int buf_len,
36 const net::CompletionCallback& callback) = 0;
37
38 // Move the current cursor position to |offset| asynchronously.
kinuko 2012/04/20 11:26:37 nit: Moves
kinaba 2012/04/23 08:56:41 Done.
39 //
40 // If the operation could not be performed, it returns an error code.
41 // Otherwise, net::ERR_IO_PENDING is returned, and the callback will be run on
42 // the thread where Seek() was called when the seek has completed.
43 //
44 // It is invalid to call Seek while there is an in-flight async operation.
kinuko 2012/04/20 11:26:37 I said we could keep this as is for now, but on th
kinaba 2012/04/23 08:56:41 I'm now inclined to drop Seek() and restrict seeki
45 virtual int Seek(int64 offset,
46 const net::Int64CompletionCallback& callback) = 0;
47
48 // Cancels an in-flight async operation (Write or Seek). When the cancel is
49 // done, |callback| is called. The callback function passed to the canceled
50 // async operation is not called.
51 virtual void Cancel(const net::CompletionCallback& callback) = 0;
52 };
53
54 } // namespace fileapi
55
56 #endif // WEBKIT_FILEAPI_FILE_WRITER_H_
57
OLDNEW
« no previous file with comments | « no previous file | webkit/fileapi/local_file_writer.h » ('j') | webkit/fileapi/local_file_writer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698