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_READER_H_ | 5 #ifndef WEBKIT_BLOB_LOCAL_FILE_READER_H_ |
6 #define WEBKIT_BLOB_LOCAL_FILE_READER_H_ | 6 #define WEBKIT_BLOB_LOCAL_FILE_READER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 // A thin wrapper of net::FileStream with range support for sliced file | 28 // A thin wrapper of net::FileStream with range support for sliced file |
29 // handling. | 29 // handling. |
30 class BLOB_EXPORT LocalFileReader { | 30 class BLOB_EXPORT LocalFileReader { |
31 public: | 31 public: |
32 typedef base::Callback<void(int error, scoped_ptr<net::FileStream> stream)> | 32 typedef base::Callback<void(int error, scoped_ptr<net::FileStream> stream)> |
33 OpenFileStreamCallback; | 33 OpenFileStreamCallback; |
34 | 34 |
35 // Creates a new FileReader for a local file |file_path|. | 35 // Creates a new FileReader for a local file |file_path|. |
36 // |initial_offset| specifies the offset in the file where the first read | 36 // |initial_offset| specifies the offset in the file where the first read |
37 // should start. If the given offset is out of the file range any | 37 // should start. |
38 // read operation may error out with net::ERR_REQUEST_RANGE_NOT_SATISFIABLE. | |
39 // | |
40 // |expected_modification_time| specifies the expected last modification | 38 // |expected_modification_time| specifies the expected last modification |
41 // If the value is non-null, the reader will check the underlying file's | 39 // If the value is non-null, the reader will check the underlying file's |
42 // actual modification time to see if the file has been modified, and if | 40 // actual modification time to see if the file has been modified, and if |
43 // it does any succeeding read operations should fail with | 41 // it does any succeeding read operations should fail with |
44 // ERR_UPLOAD_FILE_CHANGED error. | 42 // ERR_UPLOAD_FILE_CHANGED error. |
45 LocalFileReader(base::MessageLoopProxy* file_thread_proxy, | 43 LocalFileReader(base::MessageLoopProxy* file_thread_proxy, |
46 const FilePath& file_path, | 44 const FilePath& file_path, |
47 int64 initial_offset, | 45 int64 initial_offset, |
48 const base::Time& expected_modification_time); | 46 const base::Time& expected_modification_time); |
49 | 47 |
(...skipping 26 matching lines...) Expand all Loading... |
76 const FilePath file_path_; | 74 const FilePath file_path_; |
77 const int64 initial_offset_; | 75 const int64 initial_offset_; |
78 const base::Time expected_modification_time_; | 76 const base::Time expected_modification_time_; |
79 bool has_pending_open_; | 77 bool has_pending_open_; |
80 base::WeakPtrFactory<LocalFileReader> weak_factory_; | 78 base::WeakPtrFactory<LocalFileReader> weak_factory_; |
81 }; | 79 }; |
82 | 80 |
83 } // namespace webkit_blob | 81 } // namespace webkit_blob |
84 | 82 |
85 #endif // WEBKIT_BLOB_LOCAL_FILE_READER_H_ | 83 #endif // WEBKIT_BLOB_LOCAL_FILE_READER_H_ |
OLD | NEW |