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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media_galleries/linux/mtp_device_task_helper.h
diff --git a/chrome/browser/media_galleries/linux/mtp_device_task_helper.h b/chrome/browser/media_galleries/linux/mtp_device_task_helper.h
index 9c1a8f6d8fd0634f9473c536076cd58b65ff616b..9b991b3202e7eef30f6e192d69bc9a2a1550632c 100644
--- a/chrome/browser/media_galleries/linux/mtp_device_task_helper.h
+++ b/chrome/browser/media_galleries/linux/mtp_device_task_helper.h
@@ -32,6 +32,8 @@ class MTPDeviceTaskHelper {
typedef MTPDeviceAsyncDelegate::GetFileInfoSuccessCallback
GetFileInfoSuccessCallback;
+ typedef base::Callback<void(int)> ReadBytesSuccessCallback;
+
typedef base::Callback<void(const fileapi::AsyncFileUtil::EntryList&)>
ReadDirectorySuccessCallback;
@@ -89,10 +91,15 @@ class MTPDeviceTaskHelper {
// Dispatches the read bytes request to the MediaTransferProtocolManager.
//
- // |request| contains details about the byte request including the file path,
- // byte range, and the callbacks. The callbacks specified within |request| are
- // called on the IO thread to notify the caller about success or failure.
- void ReadBytes(const MTPDeviceAsyncDelegate::ReadBytesRequest& request);
+ // |success_callback| is invoked on the IO thread to notify the caller about
+ // the number of bytes read.
+ //
+ // If there is an error, |error_callback| is invoked on the IO thread to
+ // notify the caller about the file error.
+ void ReadBytes(const std::string& device_file_relative_path,
+ net::IOBuffer* buf, int64 offset, int buf_len,
+ const ReadBytesSuccessCallback& success_callback,
+ const ErrorCallback& error_callback);
// Dispatches the CloseStorage request to the MediaTransferProtocolManager.
void CloseStorage() const;
@@ -139,15 +146,16 @@ class MTPDeviceTaskHelper {
// Query callback for ReadBytes();
//
- // If there is no error, |error| is set to false, the buffer within |request|
- // is written to, and the success callback within |request| is invoked on the
- // IO thread to notify the caller.
+ // If there is no error, |error| is set to false, the buffer |buf| is written
+ // to, and |success_callback| is invoked on the IO thread to notify the
+ // caller.
//
- // If there is an error, |error| is set to true, the buffer within |request|
- // is untouched, and the error callback within |request| is invoked on the
- // IO thread to notify the caller.
+ // If there is an error, |error| is set to true, |buf| is untouched, and
+ // |error_callback| is invoked on the IO thread to notify the caller.
void OnDidReadBytes(
- const MTPDeviceAsyncDelegate::ReadBytesRequest& request,
+ net::IOBuffer* buf, int buf_len,
+ const ReadBytesSuccessCallback& success_callback,
+ const ErrorCallback& error_callback,
const std::string& data,
bool error) const;

Powered by Google App Engine
This is Rietveld 408576698