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 21 matching lines...) Expand all Loading... |
32 // |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 |
33 // 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 |
34 // 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. |
35 // | 35 // |
36 // |expected_modification_time| specifies the expected last modification | 36 // |expected_modification_time| specifies the expected last modification |
37 // 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 |
38 // 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 |
39 // it does any succeeding read operations should fail with | 39 // it does any succeeding read operations should fail with |
40 // ERR_UPLOAD_FILE_CHANGED error. | 40 // ERR_UPLOAD_FILE_CHANGED error. |
41 LocalFileStreamReader(base::TaskRunner* task_runner, | 41 LocalFileStreamReader(base::TaskRunner* task_runner, |
42 const FilePath& file_path, | 42 const base::FilePath& file_path, |
43 int64 initial_offset, | 43 int64 initial_offset, |
44 const base::Time& expected_modification_time); | 44 const base::Time& expected_modification_time); |
45 virtual ~LocalFileStreamReader(); | 45 virtual ~LocalFileStreamReader(); |
46 | 46 |
47 // FileStreamReader overrides. | 47 // FileStreamReader overrides. |
48 virtual int Read(net::IOBuffer* buf, int buf_len, | 48 virtual int Read(net::IOBuffer* buf, int buf_len, |
49 const net::CompletionCallback& callback) OVERRIDE; | 49 const net::CompletionCallback& callback) OVERRIDE; |
50 virtual int GetLength( | 50 virtual int GetLength( |
51 const net::Int64CompletionCallback& callback) OVERRIDE; | 51 const net::Int64CompletionCallback& callback) OVERRIDE; |
52 | 52 |
(...skipping 11 matching lines...) Expand all Loading... |
64 int buf_len, | 64 int buf_len, |
65 const net::CompletionCallback& callback, | 65 const net::CompletionCallback& callback, |
66 int open_result); | 66 int open_result); |
67 | 67 |
68 void DidGetFileInfoForGetLength(const net::Int64CompletionCallback& callback, | 68 void DidGetFileInfoForGetLength(const net::Int64CompletionCallback& callback, |
69 base::PlatformFileError error, | 69 base::PlatformFileError error, |
70 const base::PlatformFileInfo& file_info); | 70 const base::PlatformFileInfo& file_info); |
71 | 71 |
72 scoped_refptr<base::TaskRunner> task_runner_; | 72 scoped_refptr<base::TaskRunner> task_runner_; |
73 scoped_ptr<net::FileStream> stream_impl_; | 73 scoped_ptr<net::FileStream> stream_impl_; |
74 const FilePath file_path_; | 74 const base::FilePath file_path_; |
75 const int64 initial_offset_; | 75 const int64 initial_offset_; |
76 const base::Time expected_modification_time_; | 76 const base::Time expected_modification_time_; |
77 bool has_pending_open_; | 77 bool has_pending_open_; |
78 base::WeakPtrFactory<LocalFileStreamReader> weak_factory_; | 78 base::WeakPtrFactory<LocalFileStreamReader> weak_factory_; |
79 }; | 79 }; |
80 | 80 |
81 } // namespace webkit_blob | 81 } // namespace webkit_blob |
82 | 82 |
83 #endif // WEBKIT_BLOB_LOCAL_FILE_STREAM_READER_H_ | 83 #endif // WEBKIT_BLOB_LOCAL_FILE_STREAM_READER_H_ |
OLD | NEW |