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

Side by Side Diff: chrome/browser/media_gallery/linux/mtp_read_file_worker.cc

Issue 11744030: Try 2 [Media Gallery] Move chrome/browser/media_transfer_protocol code to src/device. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed gyp dependencies. Created 7 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/media_gallery/linux/mtp_read_file_worker.h" 5 #include "chrome/browser/media_gallery/linux/mtp_read_file_worker.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/sequenced_task_runner.h" 13 #include "base/sequenced_task_runner.h"
14 #include "base/synchronization/waitable_event.h" 14 #include "base/synchronization/waitable_event.h"
15 #include "chrome/browser/media_transfer_protocol/media_transfer_protocol_manager .h"
16 #include "chrome/browser/media_transfer_protocol/mtp_file_entry.pb.h"
17 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h"
17 #include "device/media_transfer_protocol/mtp_file_entry.pb.h"
18 #include "third_party/cros_system_api/dbus/service_constants.h" 18 #include "third_party/cros_system_api/dbus/service_constants.h"
19 19
20 using content::BrowserThread; 20 using content::BrowserThread;
21 21
22 namespace chrome { 22 namespace chrome {
23 23
24 MTPReadFileWorker::MTPReadFileWorker(const std::string& handle, 24 MTPReadFileWorker::MTPReadFileWorker(const std::string& handle,
25 const std::string& src_path, 25 const std::string& src_path,
26 uint32 total_size, 26 uint32 total_size,
27 const FilePath& dest_path, 27 const FilePath& dest_path,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 on_task_completed_event_->Signal(); 105 on_task_completed_event_->Signal();
106 } 106 }
107 107
108 uint32 MTPReadFileWorker::BytesToRead() const { 108 uint32 MTPReadFileWorker::BytesToRead() const {
109 // Read data in 1 MB chunks. 109 // Read data in 1 MB chunks.
110 static const uint32 kReadChunkSize = 1024 * 1024; 110 static const uint32 kReadChunkSize = 1024 * 1024;
111 return std::min(kReadChunkSize, total_bytes_ - bytes_read_); 111 return std::min(kReadChunkSize, total_bytes_ - bytes_read_);
112 } 112 }
113 113
114 } // namespace chrome 114 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698