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_BLOB_FILE_STREAM_READER_H_ | 5 #ifndef WEBKIT_BLOB_FILE_STREAM_READER_H_ |
6 #define WEBKIT_BLOB_FILE_STREAM_READER_H_ | 6 #define WEBKIT_BLOB_FILE_STREAM_READER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
11 #include "webkit/storage/webkit_storage_export.h" | 11 #include "webkit/browser/webkit_storage_browser_export.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 class IOBuffer; | 14 class IOBuffer; |
15 } | 15 } |
16 | 16 |
17 namespace webkit_blob { | 17 namespace webkit_blob { |
18 | 18 |
19 // A generic interface for reading a file-like object. | 19 // A generic interface for reading a file-like object. |
20 class WEBKIT_STORAGE_EXPORT FileStreamReader { | 20 class WEBKIT_STORAGE_BROWSER_EXPORT FileStreamReader { |
21 public: | 21 public: |
22 // It is valid to delete the reader at any time. If the stream is deleted | 22 // It is valid to delete the reader at any time. If the stream is deleted |
23 // while it has a pending read, its callback will not be called. | 23 // while it has a pending read, its callback will not be called. |
24 virtual ~FileStreamReader() {} | 24 virtual ~FileStreamReader() {} |
25 | 25 |
26 // Reads from the current cursor position asynchronously. | 26 // Reads from the current cursor position asynchronously. |
27 // | 27 // |
28 // Up to buf_len bytes will be copied into buf. (In other words, partial | 28 // Up to buf_len bytes will be copied into buf. (In other words, partial |
29 // reads are allowed.) Returns the number of bytes copied, 0 if at | 29 // reads are allowed.) Returns the number of bytes copied, 0 if at |
30 // end-of-file, or an error code if the operation could not be performed. | 30 // end-of-file, or an error code if the operation could not be performed. |
(...skipping 16 matching lines...) Expand all Loading... |
47 // |callback| will not be called. | 47 // |callback| will not be called. |
48 // Note that the return type is int64 to return a larger file's size (a file | 48 // Note that the return type is int64 to return a larger file's size (a file |
49 // larger than 2G) but an error code should fit in the int range (may be | 49 // larger than 2G) but an error code should fit in the int range (may be |
50 // smaller than int64 range). | 50 // smaller than int64 range). |
51 virtual int64 GetLength(const net::Int64CompletionCallback& callback) = 0; | 51 virtual int64 GetLength(const net::Int64CompletionCallback& callback) = 0; |
52 }; | 52 }; |
53 | 53 |
54 } // namespace webkit_blob | 54 } // namespace webkit_blob |
55 | 55 |
56 #endif // WEBKIT_BLOB_FILE_STREAM_READER_H_ | 56 #endif // WEBKIT_BLOB_FILE_STREAM_READER_H_ |
OLD | NEW |