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_LOCAL_FILE_STREAM_READER_H_ | 5 #ifndef WEBKIT_BLOB_LOCAL_FILE_STREAM_READER_H_ |
6 #define WEBKIT_BLOB_LOCAL_FILE_STREAM_READER_H_ | 6 #define WEBKIT_BLOB_LOCAL_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/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace net { | 21 namespace net { |
22 class FileStream; | 22 class FileStream; |
23 } | 23 } |
24 | 24 |
25 namespace webkit_blob { | 25 namespace webkit_blob { |
26 | 26 |
27 // A thin wrapper of net::FileStream with range support for sliced file | 27 // A thin wrapper of net::FileStream with range support for sliced file |
28 // handling. | 28 // handling. |
29 class BLOB_EXPORT LocalFileStreamReader : public FileStreamReader { | 29 class BLOB_EXPORT LocalFileStreamReader : public FileStreamReader { |
30 public: | 30 public: |
31 // A convenient method to translate platform file error to net error code. | |
32 static int PlatformFileErrorToNetError(base::PlatformFileError file_error); | |
33 | |
34 // Creates a new FileReader for a local file |file_path|. | 31 // Creates a new FileReader for a local file |file_path|. |
35 // |initial_offset| specifies the offset in the file where the first read | 32 // |initial_offset| specifies the offset in the file where the first read |
36 // should start. If the given offset is out of the file range any | 33 // should start. If the given offset is out of the file range any |
37 // read operation may error out with net::ERR_REQUEST_RANGE_NOT_SATISFIABLE. | 34 // read operation may error out with net::ERR_REQUEST_RANGE_NOT_SATISFIABLE. |
38 // | 35 // |
39 // |expected_modification_time| specifies the expected last modification | 36 // |expected_modification_time| specifies the expected last modification |
40 // If the value is non-null, the reader will check the underlying file's | 37 // If the value is non-null, the reader will check the underlying file's |
41 // actual modification time to see if the file has been modified, and if | 38 // actual modification time to see if the file has been modified, and if |
42 // it does any succeeding read operations should fail with | 39 // it does any succeeding read operations should fail with |
43 // ERR_UPLOAD_FILE_CHANGED error. | 40 // ERR_UPLOAD_FILE_CHANGED error. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 const FilePath file_path_; | 80 const FilePath file_path_; |
84 const int64 initial_offset_; | 81 const int64 initial_offset_; |
85 const base::Time expected_modification_time_; | 82 const base::Time expected_modification_time_; |
86 bool has_pending_open_; | 83 bool has_pending_open_; |
87 base::WeakPtrFactory<LocalFileStreamReader> weak_factory_; | 84 base::WeakPtrFactory<LocalFileStreamReader> weak_factory_; |
88 }; | 85 }; |
89 | 86 |
90 } // namespace webkit_blob | 87 } // namespace webkit_blob |
91 | 88 |
92 #endif // WEBKIT_BLOB_LOCAL_FILE_STREAM_READER_H_ | 89 #endif // WEBKIT_BLOB_LOCAL_FILE_STREAM_READER_H_ |
OLD | NEW |