OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reade
r.h" | 5 #include "chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reade
r.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "chrome/browser/chromeos/file_system_provider/fileapi/provider_async_fi
le_util.h" | 10 #include "chrome/browser/chromeos/file_system_provider/fileapi/provider_async_fi
le_util.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 virtual ~OperationRunner() {} | 154 virtual ~OperationRunner() {} |
155 | 155 |
156 // Remembers a file handle for further operations and forwards the result to | 156 // Remembers a file handle for further operations and forwards the result to |
157 // the IO thread. | 157 // the IO thread. |
158 void OnOpenFileCompletedOnUIThread( | 158 void OnOpenFileCompletedOnUIThread( |
159 const storage::AsyncFileUtil::StatusCallback& callback, | 159 const storage::AsyncFileUtil::StatusCallback& callback, |
160 int file_handle, | 160 int file_handle, |
161 base::File::Error result) { | 161 base::File::Error result) { |
162 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 162 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
163 | 163 |
164 file_handle_ = file_handle; | 164 if (result == base::File::FILE_OK) |
| 165 file_handle_ = file_handle; |
| 166 |
165 BrowserThread::PostTask( | 167 BrowserThread::PostTask( |
166 BrowserThread::IO, FROM_HERE, base::Bind(callback, result)); | 168 BrowserThread::IO, FROM_HERE, base::Bind(callback, result)); |
167 } | 169 } |
168 | 170 |
169 // Forwards a metadata to the IO thread. | 171 // Forwards a metadata to the IO thread. |
170 void OnGetMetadataCompletedOnUIThread( | 172 void OnGetMetadataCompletedOnUIThread( |
171 const ProvidedFileSystemInterface::GetMetadataCallback& callback, | 173 const ProvidedFileSystemInterface::GetMetadataCallback& callback, |
172 scoped_ptr<EntryMetadata> metadata, | 174 scoped_ptr<EntryMetadata> metadata, |
173 base::File::Error result) { | 175 base::File::Error result) { |
174 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 176 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 callback.Run(net::ERR_UPLOAD_FILE_CHANGED); | 489 callback.Run(net::ERR_UPLOAD_FILE_CHANGED); |
488 return; | 490 return; |
489 } | 491 } |
490 | 492 |
491 DCHECK_EQ(base::File::FILE_OK, result); | 493 DCHECK_EQ(base::File::FILE_OK, result); |
492 callback.Run(metadata->size); | 494 callback.Run(metadata->size); |
493 } | 495 } |
494 | 496 |
495 } // namespace file_system_provider | 497 } // namespace file_system_provider |
496 } // namespace chromeos | 498 } // namespace chromeos |
OLD | NEW |