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 #include "webkit/fileapi/file_system_file_stream_reader.h" | 5 #include "webkit/fileapi/file_system_file_stream_reader.h" |
6 | 6 |
7 #include "base/file_util_proxy.h" | 7 #include "base/file_util_proxy.h" |
8 #include "base/platform_file.h" | 8 #include "base/platform_file.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "net/base/file_stream.h" | 10 #include "net/base/file_stream.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 void Int64CallbackAdapter(const net::Int64CompletionCallback& callback, | 43 void Int64CallbackAdapter(const net::Int64CompletionCallback& callback, |
44 int value) { | 44 int value) { |
45 callback.Run(value); | 45 callback.Run(value); |
46 } | 46 } |
47 | 47 |
48 } // namespace | 48 } // namespace |
49 | 49 |
50 FileSystemFileStreamReader::FileSystemFileStreamReader( | 50 FileSystemFileStreamReader::FileSystemFileStreamReader( |
51 FileSystemContext* file_system_context, | 51 FileSystemContext* file_system_context, |
52 const FileSystemURL& url, | 52 const FileSystemURL& url, |
53 int64 initial_offset) | 53 int64 initial_offset, |
| 54 const base::Time& expected_modification_time) |
54 : file_system_context_(file_system_context), | 55 : file_system_context_(file_system_context), |
55 url_(url), | 56 url_(url), |
56 initial_offset_(initial_offset), | 57 initial_offset_(initial_offset), |
| 58 expected_modification_time_(expected_modification_time), |
57 has_pending_create_snapshot_(false), | 59 has_pending_create_snapshot_(false), |
58 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 60 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
59 } | 61 } |
60 | 62 |
61 FileSystemFileStreamReader::~FileSystemFileStreamReader() { | 63 FileSystemFileStreamReader::~FileSystemFileStreamReader() { |
62 } | 64 } |
63 | 65 |
64 int FileSystemFileStreamReader::Read( | 66 int FileSystemFileStreamReader::Read( |
65 net::IOBuffer* buf, int buf_len, | 67 net::IOBuffer* buf, int buf_len, |
66 const net::CompletionCallback& callback) { | 68 const net::CompletionCallback& callback) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 error_callback.Run(net::PlatformFileErrorToNetError(file_error)); | 117 error_callback.Run(net::PlatformFileErrorToNetError(file_error)); |
116 return; | 118 return; |
117 } | 119 } |
118 | 120 |
119 // Keep the reference (if it's non-null) so that the file won't go away. | 121 // Keep the reference (if it's non-null) so that the file won't go away. |
120 snapshot_ref_ = file_ref; | 122 snapshot_ref_ = file_ref; |
121 | 123 |
122 local_file_reader_.reset( | 124 local_file_reader_.reset( |
123 new LocalFileStreamReader( | 125 new LocalFileStreamReader( |
124 file_system_context_->task_runners()->file_task_runner(), | 126 file_system_context_->task_runners()->file_task_runner(), |
125 platform_path, initial_offset_, base::Time())); | 127 platform_path, initial_offset_, expected_modification_time_)); |
126 | 128 |
127 callback.Run(); | 129 callback.Run(); |
128 } | 130 } |
129 | 131 |
130 } // namespace fileapi | 132 } // namespace fileapi |
OLD | NEW |