| 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_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_ |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_ |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "webkit/fileapi/file_system_url.h" | |
| 13 #include "webkit/fileapi/fileapi_export.h" | |
| 14 #include "webkit/blob/file_stream_reader.h" | 12 #include "webkit/blob/file_stream_reader.h" |
| 15 #include "webkit/blob/shareable_file_reference.h" | 13 #include "webkit/blob/shareable_file_reference.h" |
| 14 #include "webkit/fileapi/file_system_url.h" |
| 15 #include "webkit/storage/webkit_storage_export.h" |
| 16 | 16 |
| 17 class FilePath; | 17 class FilePath; |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class SequencedTaskRunner; | 20 class SequencedTaskRunner; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace webkit_blob { | 23 namespace webkit_blob { |
| 24 class LocalFileStreamReader; | 24 class LocalFileStreamReader; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace fileapi { | 27 namespace fileapi { |
| 28 | 28 |
| 29 class FileSystemContext; | 29 class FileSystemContext; |
| 30 | 30 |
| 31 // TODO(kinaba,satorux): This generic implementation would work for any | 31 // TODO(kinaba,satorux): This generic implementation would work for any |
| 32 // filesystems but remote filesystem should implement its own reader | 32 // filesystems but remote filesystem should implement its own reader |
| 33 // rather than relying on FileSystemOperation::GetSnapshotFile() which | 33 // rather than relying on FileSystemOperation::GetSnapshotFile() which |
| 34 // may force downloading the entire contents for remote files. | 34 // may force downloading the entire contents for remote files. |
| 35 class FILEAPI_EXPORT_PRIVATE FileSystemFileStreamReader | 35 class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemFileStreamReader |
| 36 : public webkit_blob::FileStreamReader { | 36 : public webkit_blob::FileStreamReader { |
| 37 public: | 37 public: |
| 38 // Creates a new FileReader for a filesystem URL |url| form |initial_offset|. | 38 // Creates a new FileReader for a filesystem URL |url| form |initial_offset|. |
| 39 // |expected_modification_time| specifies the expected last modification if | 39 // |expected_modification_time| specifies the expected last modification if |
| 40 // the value is non-null, the reader will check the underlying file's actual | 40 // the value is non-null, the reader will check the underlying file's actual |
| 41 // modification time to see if the file has been modified, and if it does any | 41 // modification time to see if the file has been modified, and if it does any |
| 42 // succeeding read operations should fail with ERR_UPLOAD_FILE_CHANGED error. | 42 // succeeding read operations should fail with ERR_UPLOAD_FILE_CHANGED error. |
| 43 FileSystemFileStreamReader(FileSystemContext* file_system_context, | 43 FileSystemFileStreamReader(FileSystemContext* file_system_context, |
| 44 const FileSystemURL& url, | 44 const FileSystemURL& url, |
| 45 int64 initial_offset, | 45 int64 initial_offset, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 71 scoped_refptr<webkit_blob::ShareableFileReference> snapshot_ref_; | 71 scoped_refptr<webkit_blob::ShareableFileReference> snapshot_ref_; |
| 72 bool has_pending_create_snapshot_; | 72 bool has_pending_create_snapshot_; |
| 73 base::WeakPtrFactory<FileSystemFileStreamReader> weak_factory_; | 73 base::WeakPtrFactory<FileSystemFileStreamReader> weak_factory_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(FileSystemFileStreamReader); | 75 DISALLOW_COPY_AND_ASSIGN(FileSystemFileStreamReader); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 } // namespace fileapi | 78 } // namespace fileapi |
| 79 | 79 |
| 80 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_ | 80 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_ |
| OLD | NEW |