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/browser/blob/local_file_stream_reader.h" | 5 #include "webkit/browser/blob/local_file_stream_reader.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_util_proxy.h" | 8 #include "base/files/file_util_proxy.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/platform_file.h" | |
12 #include "base/task_runner.h" | 11 #include "base/task_runner.h" |
13 #include "net/base/file_stream.h" | 12 #include "net/base/file_stream.h" |
14 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
15 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
16 | 15 |
17 namespace webkit_blob { | 16 namespace webkit_blob { |
18 | 17 |
19 namespace { | 18 namespace { |
20 | 19 |
21 const int kOpenFlagsForRead = base::PLATFORM_FILE_OPEN | | 20 const int kOpenFlagsForRead = base::File::FLAG_OPEN | |
22 base::PLATFORM_FILE_READ | | 21 base::File::FLAG_READ | |
23 base::PLATFORM_FILE_ASYNC; | 22 base::File::FLAG_ASYNC; |
24 | 23 |
25 } // namespace | 24 } // namespace |
26 | 25 |
27 FileStreamReader* FileStreamReader::CreateForLocalFile( | 26 FileStreamReader* FileStreamReader::CreateForLocalFile( |
28 base::TaskRunner* task_runner, | 27 base::TaskRunner* task_runner, |
29 const base::FilePath& file_path, | 28 const base::FilePath& file_path, |
30 int64 initial_offset, | 29 int64 initial_offset, |
31 const base::Time& expected_modification_time) { | 30 const base::Time& expected_modification_time) { |
32 return new LocalFileStreamReader(task_runner, file_path, initial_offset, | 31 return new LocalFileStreamReader(task_runner, file_path, initial_offset, |
33 expected_modification_time); | 32 expected_modification_time); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 return; | 160 return; |
162 } | 161 } |
163 if (!VerifySnapshotTime(expected_modification_time_, file_info)) { | 162 if (!VerifySnapshotTime(expected_modification_time_, file_info)) { |
164 callback.Run(net::ERR_UPLOAD_FILE_CHANGED); | 163 callback.Run(net::ERR_UPLOAD_FILE_CHANGED); |
165 return; | 164 return; |
166 } | 165 } |
167 callback.Run(file_info.size); | 166 callback.Run(file_info.size); |
168 } | 167 } |
169 | 168 |
170 } // namespace webkit_blob | 169 } // namespace webkit_blob |
OLD | NEW |