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/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
10 #include "net/base/file_stream.h" | 10 #include "net/base/file_stream.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 const net::CompletionCallback& callback, | 72 const net::CompletionCallback& callback, |
73 base::PlatformFileError file_error, | 73 base::PlatformFileError file_error, |
74 const base::PlatformFileInfo& file_info, | 74 const base::PlatformFileInfo& file_info, |
75 const FilePath& platform_path, | 75 const FilePath& platform_path, |
76 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { | 76 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { |
77 DCHECK(has_pending_create_snapshot_); | 77 DCHECK(has_pending_create_snapshot_); |
78 DCHECK(!local_file_reader_.get()); | 78 DCHECK(!local_file_reader_.get()); |
79 has_pending_create_snapshot_ = false; | 79 has_pending_create_snapshot_ = false; |
80 | 80 |
81 if (file_error != base::PLATFORM_FILE_OK) { | 81 if (file_error != base::PLATFORM_FILE_OK) { |
82 callback.Run( | 82 callback.Run(net::PlatformFileErrorToNetError(file_error)); |
83 LocalFileStreamReader::PlatformFileErrorToNetError(file_error)); | |
84 return; | 83 return; |
85 } | 84 } |
86 | 85 |
87 // Keep the reference (if it's non-null) so that the file won't go away. | 86 // Keep the reference (if it's non-null) so that the file won't go away. |
88 snapshot_ref_ = file_ref; | 87 snapshot_ref_ = file_ref; |
89 | 88 |
90 local_file_reader_.reset( | 89 local_file_reader_.reset( |
91 new LocalFileStreamReader(file_system_context_->file_task_runner(), | 90 new LocalFileStreamReader(file_system_context_->file_task_runner(), |
92 platform_path, | 91 platform_path, |
93 initial_offset_, | 92 initial_offset_, |
94 base::Time())); | 93 base::Time())); |
95 | 94 |
96 read_closure.Run(); | 95 read_closure.Run(); |
97 } | 96 } |
98 | 97 |
99 } // namespace fileapi | 98 } // namespace fileapi |
OLD | NEW |