Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: chrome/browser/media_galleries/linux/mtp_device_task_helper.h

Issue 180783005: MTP Streaming: Optimize block reading (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_
6 #define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ 6 #define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // to notify the caller. 130 // to notify the caller.
131 // 131 //
132 // If there is an error, |error| is set to true, |file_entries| is empty 132 // If there is an error, |error| is set to true, |file_entries| is empty
133 // and |error_callback| is invoked on the IO thread to notify the caller. 133 // and |error_callback| is invoked on the IO thread to notify the caller.
134 void OnDidReadDirectoryByPath( 134 void OnDidReadDirectoryByPath(
135 const ReadDirectorySuccessCallback& success_callback, 135 const ReadDirectorySuccessCallback& success_callback,
136 const ErrorCallback& error_callback, 136 const ErrorCallback& error_callback,
137 const std::vector<MtpFileEntry>& file_entries, 137 const std::vector<MtpFileEntry>& file_entries,
138 bool error) const; 138 bool error) const;
139 139
140 // Intermediate step to finish a ReadBytes request.
141 void OnGetFileInfoToReadBytes(
142 const MTPDeviceAsyncDelegate::ReadBytesRequest& request,
143 const MtpFileEntry& file_entry,
144 bool error);
145
140 // Query callback for ReadBytes(); 146 // Query callback for ReadBytes();
141 // 147 //
142 // If there is no error, |error| is set to false, the buffer within |request| 148 // If there is no error, |error| is set to false, the buffer within |request|
143 // is written to, and the success callback within |request| is invoked on the 149 // is written to, and the success callback within |request| is invoked on the
144 // IO thread to notify the caller. 150 // IO thread to notify the caller.
145 // 151 //
146 // If there is an error, |error| is set to true, the buffer within |request| 152 // If there is an error, |error| is set to true, the buffer within |request|
147 // is untouched, and the error callback within |request| is invoked on the 153 // is untouched, and the error callback within |request| is invoked on the
148 // IO thread to notify the caller. 154 // IO thread to notify the caller.
149 void OnDidReadBytes( 155 void OnDidReadBytes(
150 const MTPDeviceAsyncDelegate::ReadBytesRequest& request, 156 const MTPDeviceAsyncDelegate::ReadBytesRequest& request,
157 const base::File::Info& file_info,
151 const std::string& data, 158 const std::string& data,
152 bool error) const; 159 bool error) const;
153 160
154 // Called when the device is uninitialized. 161 // Called when the device is uninitialized.
155 // 162 //
156 // Runs |error_callback| on the IO thread to notify the caller about the 163 // Runs |error_callback| on the IO thread to notify the caller about the
157 // device |error|. 164 // device |error|.
158 void HandleDeviceError(const ErrorCallback& error_callback, 165 void HandleDeviceError(const ErrorCallback& error_callback,
159 base::File::Error error) const; 166 base::File::Error error) const;
160 167
161 // Handle to communicate with the MTP device. 168 // Handle to communicate with the MTP device.
162 std::string device_handle_; 169 std::string device_handle_;
163 170
164 // Used to handle WriteDataInfoSnapshotFile request. 171 // Used to handle WriteDataInfoSnapshotFile request.
165 scoped_ptr<MTPReadFileWorker> read_file_worker_; 172 scoped_ptr<MTPReadFileWorker> read_file_worker_;
166 173
167 // For callbacks that may run after destruction. 174 // For callbacks that may run after destruction.
168 base::WeakPtrFactory<MTPDeviceTaskHelper> weak_ptr_factory_; 175 base::WeakPtrFactory<MTPDeviceTaskHelper> weak_ptr_factory_;
169 176
170 DISALLOW_COPY_AND_ASSIGN(MTPDeviceTaskHelper); 177 DISALLOW_COPY_AND_ASSIGN(MTPDeviceTaskHelper);
171 }; 178 };
172 179
173 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_ 180 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_TASK_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698