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/fileapi/file_system_file_stream_reader.h" | 5 #include "webkit/browser/fileapi/file_system_file_stream_reader.h" |
6 | 6 |
7 #include "base/files/file_util_proxy.h" | 7 #include "base/files/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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 base::Bind(&FileSystemFileStreamReader::DidCreateSnapshot, | 110 base::Bind(&FileSystemFileStreamReader::DidCreateSnapshot, |
111 weak_factory_.GetWeakPtr(), | 111 weak_factory_.GetWeakPtr(), |
112 callback, | 112 callback, |
113 error_callback)); | 113 error_callback)); |
114 return net::ERR_IO_PENDING; | 114 return net::ERR_IO_PENDING; |
115 } | 115 } |
116 | 116 |
117 void FileSystemFileStreamReader::DidCreateSnapshot( | 117 void FileSystemFileStreamReader::DidCreateSnapshot( |
118 const base::Closure& callback, | 118 const base::Closure& callback, |
119 const net::CompletionCallback& error_callback, | 119 const net::CompletionCallback& error_callback, |
120 base::PlatformFileError file_error, | 120 base::File::Error file_error, |
121 const base::PlatformFileInfo& file_info, | 121 const base::File::Info& file_info, |
122 const base::FilePath& platform_path, | 122 const base::FilePath& platform_path, |
123 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { | 123 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { |
124 DCHECK(has_pending_create_snapshot_); | 124 DCHECK(has_pending_create_snapshot_); |
125 DCHECK(!local_file_reader_.get()); | 125 DCHECK(!local_file_reader_.get()); |
126 has_pending_create_snapshot_ = false; | 126 has_pending_create_snapshot_ = false; |
127 | 127 |
128 if (file_error != base::PLATFORM_FILE_OK) { | 128 if (file_error != base::File::FILE_OK) { |
129 error_callback.Run(net::PlatformFileErrorToNetError(file_error)); | 129 error_callback.Run(net::FileErrorToNetError(file_error)); |
130 return; | 130 return; |
131 } | 131 } |
132 | 132 |
133 // Keep the reference (if it's non-null) so that the file won't go away. | 133 // Keep the reference (if it's non-null) so that the file won't go away. |
134 snapshot_ref_ = file_ref; | 134 snapshot_ref_ = file_ref; |
135 | 135 |
136 local_file_reader_.reset( | 136 local_file_reader_.reset( |
137 FileStreamReader::CreateForLocalFile( | 137 FileStreamReader::CreateForLocalFile( |
138 file_system_context_->default_file_task_runner(), | 138 file_system_context_->default_file_task_runner(), |
139 platform_path, initial_offset_, expected_modification_time_)); | 139 platform_path, initial_offset_, expected_modification_time_)); |
140 | 140 |
141 callback.Run(); | 141 callback.Run(); |
142 } | 142 } |
143 | 143 |
144 } // namespace fileapi | 144 } // namespace fileapi |
OLD | NEW |