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 "base/files/file.h" |
10 #include "net/base/completion_callback.h" | 11 #include "net/base/completion_callback.h" |
11 #include "webkit/browser/webkit_storage_browser_export.h" | 12 #include "webkit/browser/webkit_storage_browser_export.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 class FilePath; | 15 class FilePath; |
15 struct PlatformFileInfo; | |
16 class TaskRunner; | 16 class TaskRunner; |
17 class Time; | 17 class Time; |
18 } | 18 } |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 class IOBuffer; | 21 class IOBuffer; |
22 } | 22 } |
23 | 23 |
24 namespace fileapi { | 24 namespace fileapi { |
25 class FileSystemContext; | 25 class FileSystemContext; |
(...skipping 27 matching lines...) Expand all Loading... |
53 // succeeding read operations should fail with ERR_UPLOAD_FILE_CHANGED error. | 53 // succeeding read operations should fail with ERR_UPLOAD_FILE_CHANGED error. |
54 WEBKIT_STORAGE_BROWSER_EXPORT static FileStreamReader* | 54 WEBKIT_STORAGE_BROWSER_EXPORT static FileStreamReader* |
55 CreateForFileSystemFile(fileapi::FileSystemContext* context, | 55 CreateForFileSystemFile(fileapi::FileSystemContext* context, |
56 const fileapi::FileSystemURL& url, | 56 const fileapi::FileSystemURL& url, |
57 int64 initial_offset, | 57 int64 initial_offset, |
58 const base::Time& expected_modification_time); | 58 const base::Time& expected_modification_time); |
59 | 59 |
60 // Verify if the underlying file has not been modified. | 60 // Verify if the underlying file has not been modified. |
61 WEBKIT_STORAGE_BROWSER_EXPORT static bool VerifySnapshotTime( | 61 WEBKIT_STORAGE_BROWSER_EXPORT static bool VerifySnapshotTime( |
62 const base::Time& expected_modification_time, | 62 const base::Time& expected_modification_time, |
63 const base::PlatformFileInfo& file_info); | 63 const base::File::Info& file_info); |
64 | 64 |
65 // It is valid to delete the reader at any time. If the stream is deleted | 65 // It is valid to delete the reader at any time. If the stream is deleted |
66 // while it has a pending read, its callback will not be called. | 66 // while it has a pending read, its callback will not be called. |
67 virtual ~FileStreamReader() {} | 67 virtual ~FileStreamReader() {} |
68 | 68 |
69 // Reads from the current cursor position asynchronously. | 69 // Reads from the current cursor position asynchronously. |
70 // | 70 // |
71 // Up to buf_len bytes will be copied into buf. (In other words, partial | 71 // Up to buf_len bytes will be copied into buf. (In other words, partial |
72 // reads are allowed.) Returns the number of bytes copied, 0 if at | 72 // reads are allowed.) Returns the number of bytes copied, 0 if at |
73 // end-of-file, or an error code if the operation could not be performed. | 73 // end-of-file, or an error code if the operation could not be performed. |
(...skipping 16 matching lines...) Expand all Loading... |
90 // |callback| will not be called. | 90 // |callback| will not be called. |
91 // Note that the return type is int64 to return a larger file's size (a file | 91 // Note that the return type is int64 to return a larger file's size (a file |
92 // larger than 2G) but an error code should fit in the int range (may be | 92 // larger than 2G) but an error code should fit in the int range (may be |
93 // smaller than int64 range). | 93 // smaller than int64 range). |
94 virtual int64 GetLength(const net::Int64CompletionCallback& callback) = 0; | 94 virtual int64 GetLength(const net::Int64CompletionCallback& callback) = 0; |
95 }; | 95 }; |
96 | 96 |
97 } // namespace webkit_blob | 97 } // namespace webkit_blob |
98 | 98 |
99 #endif // WEBKIT_BLOB_FILE_STREAM_READER_H_ | 99 #endif // WEBKIT_BLOB_FILE_STREAM_READER_H_ |
OLD | NEW |