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

Unified Diff: device/media_transfer_protocol/media_transfer_protocol_daemon_client.cc

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
« no previous file with comments | « chrome/browser/media_galleries/linux/mtp_device_task_helper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/media_transfer_protocol/media_transfer_protocol_daemon_client.cc
diff --git a/device/media_transfer_protocol/media_transfer_protocol_daemon_client.cc b/device/media_transfer_protocol/media_transfer_protocol_daemon_client.cc
index 5df7ef00c098adf4f934e5198a9f5c8d31fdcf52..4edfc60f1e574038d54c7dbf7a394bfb191688c2 100644
--- a/device/media_transfer_protocol/media_transfer_protocol_daemon_client.cc
+++ b/device/media_transfer_protocol/media_transfer_protocol_daemon_client.cc
@@ -19,6 +19,7 @@ namespace device {
namespace {
const char kInvalidResponseMsg[] = "Invalid Response: ";
+uint32 kMaxChunkSize = 1024*1024; // D-Bus has message size limits.
// The MediaTransferProtocolDaemonClient implementation.
class MediaTransferProtocolDaemonClientImpl
@@ -140,6 +141,7 @@ class MediaTransferProtocolDaemonClientImpl
uint32 bytes_to_read,
const ReadFileCallback& callback,
const ErrorCallback& error_callback) OVERRIDE {
+ DCHECK_LE(bytes_to_read, kMaxChunkSize);
dbus::MethodCall method_call(mtpd::kMtpdInterface,
mtpd::kReadFileChunkByPath);
dbus::MessageWriter writer(&method_call);
@@ -162,6 +164,7 @@ class MediaTransferProtocolDaemonClientImpl
uint32 bytes_to_read,
const ReadFileCallback& callback,
const ErrorCallback& error_callback) OVERRIDE {
+ DCHECK_LE(bytes_to_read, kMaxChunkSize);
dbus::MethodCall method_call(mtpd::kMtpdInterface,
mtpd::kReadFileChunkById);
dbus::MessageWriter writer(&method_call);
« no previous file with comments | « chrome/browser/media_galleries/linux/mtp_device_task_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698