| 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" |
| 11 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "webkit/browser/blob/local_file_stream_reader.h" | 13 #include "webkit/browser/blob/local_file_stream_reader.h" |
| 14 #include "webkit/browser/fileapi/file_system_context.h" | 14 #include "webkit/browser/fileapi/file_system_context.h" |
| 15 #include "webkit/browser/fileapi/file_system_operation_runner.h" | 15 #include "webkit/browser/fileapi/file_system_operation_runner.h" |
| 16 #include "webkit/browser/fileapi/file_system_task_runners.h" | |
| 17 | 16 |
| 18 using webkit_blob::LocalFileStreamReader; | 17 using webkit_blob::LocalFileStreamReader; |
| 19 | 18 |
| 20 namespace fileapi { | 19 namespace fileapi { |
| 21 | 20 |
| 22 namespace { | 21 namespace { |
| 23 | 22 |
| 24 void ReadAdapter(base::WeakPtr<FileSystemFileStreamReader> reader, | 23 void ReadAdapter(base::WeakPtr<FileSystemFileStreamReader> reader, |
| 25 net::IOBuffer* buf, int buf_len, | 24 net::IOBuffer* buf, int buf_len, |
| 26 const net::CompletionCallback& callback) { | 25 const net::CompletionCallback& callback) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 if (file_error != base::PLATFORM_FILE_OK) { | 110 if (file_error != base::PLATFORM_FILE_OK) { |
| 112 error_callback.Run(net::PlatformFileErrorToNetError(file_error)); | 111 error_callback.Run(net::PlatformFileErrorToNetError(file_error)); |
| 113 return; | 112 return; |
| 114 } | 113 } |
| 115 | 114 |
| 116 // Keep the reference (if it's non-null) so that the file won't go away. | 115 // Keep the reference (if it's non-null) so that the file won't go away. |
| 117 snapshot_ref_ = file_ref; | 116 snapshot_ref_ = file_ref; |
| 118 | 117 |
| 119 local_file_reader_.reset( | 118 local_file_reader_.reset( |
| 120 new LocalFileStreamReader( | 119 new LocalFileStreamReader( |
| 121 file_system_context_->task_runners()->file_task_runner(), | 120 file_system_context_->default_file_task_runner(), |
| 122 platform_path, initial_offset_, expected_modification_time_)); | 121 platform_path, initial_offset_, expected_modification_time_)); |
| 123 | 122 |
| 124 callback.Run(); | 123 callback.Run(); |
| 125 } | 124 } |
| 126 | 125 |
| 127 } // namespace fileapi | 126 } // namespace fileapi |
| OLD | NEW |