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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 BrowserThread::PostTask( | 89 BrowserThread::PostTask( |
90 BrowserThread::IO, | 90 BrowserThread::IO, |
91 FROM_HERE, | 91 FROM_HERE, |
92 base::Bind( | 92 base::Bind( |
93 callback, 0, false /* has_more */, base::File::FILE_ERROR_ABORT)); | 93 callback, 0, false /* has_more */, base::File::FILE_ERROR_ABORT)); |
94 return; | 94 return; |
95 } | 95 } |
96 | 96 |
97 abort_callback_ = file_system_->ReadFile( | 97 abort_callback_ = file_system_->ReadFile( |
98 file_handle_, | 98 file_handle_, |
99 buffer, | 99 buffer.get(), |
100 offset, | 100 offset, |
101 length, | 101 length, |
102 base::Bind( | 102 base::Bind( |
103 &OperationRunner::OnReadFileCompletedOnUIThread, this, callback)); | 103 &OperationRunner::OnReadFileCompletedOnUIThread, this, callback)); |
104 } | 104 } |
105 | 105 |
106 // Requests metadata of a file. In case of either succes or a failure, | 106 // Requests metadata of a file. In case of either succes or a failure, |
107 // |callback| is executed. Must be called on UI thread. | 107 // |callback| is executed. Must be called on UI thread. |
108 void GetMetadataOnUIThread( | 108 void GetMetadataOnUIThread( |
109 const ProvidedFileSystemInterface::GetMetadataCallback& callback) { | 109 const ProvidedFileSystemInterface::GetMetadataCallback& callback) { |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 callback.Run(net::ERR_UPLOAD_FILE_CHANGED); | 487 callback.Run(net::ERR_UPLOAD_FILE_CHANGED); |
488 return; | 488 return; |
489 } | 489 } |
490 | 490 |
491 DCHECK_EQ(base::File::FILE_OK, result); | 491 DCHECK_EQ(base::File::FILE_OK, result); |
492 callback.Run(metadata->size); | 492 callback.Run(metadata->size); |
493 } | 493 } |
494 | 494 |
495 } // namespace file_system_provider | 495 } // namespace file_system_provider |
496 } // namespace chromeos | 496 } // namespace chromeos |
OLD | NEW |