| 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/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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 callback, | 100 callback, |
| 101 error_callback)); | 101 error_callback)); |
| 102 return net::ERR_IO_PENDING; | 102 return net::ERR_IO_PENDING; |
| 103 } | 103 } |
| 104 | 104 |
| 105 void FileSystemFileStreamReader::DidCreateSnapshot( | 105 void FileSystemFileStreamReader::DidCreateSnapshot( |
| 106 const base::Closure& callback, | 106 const base::Closure& callback, |
| 107 const net::CompletionCallback& error_callback, | 107 const net::CompletionCallback& error_callback, |
| 108 base::PlatformFileError file_error, | 108 base::PlatformFileError file_error, |
| 109 const base::PlatformFileInfo& file_info, | 109 const base::PlatformFileInfo& file_info, |
| 110 const FilePath& platform_path, | 110 const base::FilePath& platform_path, |
| 111 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { | 111 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { |
| 112 DCHECK(has_pending_create_snapshot_); | 112 DCHECK(has_pending_create_snapshot_); |
| 113 DCHECK(!local_file_reader_.get()); | 113 DCHECK(!local_file_reader_.get()); |
| 114 has_pending_create_snapshot_ = false; | 114 has_pending_create_snapshot_ = false; |
| 115 | 115 |
| 116 if (file_error != base::PLATFORM_FILE_OK) { | 116 if (file_error != base::PLATFORM_FILE_OK) { |
| 117 error_callback.Run(net::PlatformFileErrorToNetError(file_error)); | 117 error_callback.Run(net::PlatformFileErrorToNetError(file_error)); |
| 118 return; | 118 return; |
| 119 } | 119 } |
| 120 | 120 |
| 121 // 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. |
| 122 snapshot_ref_ = file_ref; | 122 snapshot_ref_ = file_ref; |
| 123 | 123 |
| 124 local_file_reader_.reset( | 124 local_file_reader_.reset( |
| 125 new LocalFileStreamReader( | 125 new LocalFileStreamReader( |
| 126 file_system_context_->task_runners()->file_task_runner(), | 126 file_system_context_->task_runners()->file_task_runner(), |
| 127 platform_path, initial_offset_, expected_modification_time_)); | 127 platform_path, initial_offset_, expected_modification_time_)); |
| 128 | 128 |
| 129 callback.Run(); | 129 callback.Run(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace fileapi | 132 } // namespace fileapi |
| OLD | NEW |