| 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 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_STREAM_WRITER_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_STREAM_WRITER_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_FILE_STREAM_WRITER_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_STREAM_WRITER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
| 10 #include "webkit/storage/webkit_storage_export.h" | 10 #include "webkit/browser/webkit_storage_browser_export.h" |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 class IOBuffer; | 13 class IOBuffer; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace fileapi { | 16 namespace fileapi { |
| 17 | 17 |
| 18 // A generic interface for writing to a file-like object. | 18 // A generic interface for writing to a file-like object. |
| 19 class WEBKIT_STORAGE_EXPORT_PRIVATE FileStreamWriter { | 19 class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE FileStreamWriter { |
| 20 public: | 20 public: |
| 21 // Closes the file. If there's an in-flight operation, it is canceled (i.e., | 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). | 22 // the callback function associated with the operation is not called). |
| 23 virtual ~FileStreamWriter() {} | 23 virtual ~FileStreamWriter() {} |
| 24 | 24 |
| 25 // Writes to the current cursor position asynchronously. | 25 // Writes to the current cursor position asynchronously. |
| 26 // | 26 // |
| 27 // Up to buf_len bytes will be written. (In other words, partial | 27 // Up to buf_len bytes will be written. (In other words, partial |
| 28 // writes are allowed.) If the write completed synchronously, it returns | 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 | 29 // the number of bytes written. If the operation could not be performed, it |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // is returned, and the callback will be run on the thread where Flush() was | 63 // is returned, and the callback will be run on the thread where Flush() was |
| 64 // called when the flush has completed. | 64 // called when the flush has completed. |
| 65 // | 65 // |
| 66 // It is invalid to call Flush while there is an in-flight async operation. | 66 // It is invalid to call Flush while there is an in-flight async operation. |
| 67 virtual int Flush(const net::CompletionCallback& callback) = 0; | 67 virtual int Flush(const net::CompletionCallback& callback) = 0; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 } // namespace fileapi | 70 } // namespace fileapi |
| 71 | 71 |
| 72 #endif // WEBKIT_BROWSER_FILEAPI_FILE_STREAM_WRITER_H_ | 72 #endif // WEBKIT_BROWSER_FILEAPI_FILE_STREAM_WRITER_H_ |
| OLD | NEW |