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

Side by Side Diff: chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.mm

Issue 1432403003: Do not call stat() when reading directories via File API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed FSP tests. Created 5 years, 1 month 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
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_galleries/mac/mtp_device_delegate_impl_mac.h" 5 #include "chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 460 }
461 if (file_paths_[i].DirName() != read_path) 461 if (file_paths_[i].DirName() != read_path)
462 continue; 462 continue;
463 463
464 base::FilePath relative_path; 464 base::FilePath relative_path;
465 read_path.AppendRelativePath(file_paths_[i], &relative_path); 465 read_path.AppendRelativePath(file_paths_[i], &relative_path);
466 base::File::Info info = file_info_[file_paths_[i].value()]; 466 base::File::Info info = file_info_[file_paths_[i].value()];
467 storage::DirectoryEntry entry; 467 storage::DirectoryEntry entry;
468 entry.name = relative_path.value(); 468 entry.name = relative_path.value();
469 entry.is_directory = info.is_directory; 469 entry.is_directory = info.is_directory;
470 entry.size = info.size;
471 entry.last_modified_time = info.last_modified;
472 entry_list.push_back(entry); 470 entry_list.push_back(entry);
473 } 471 }
474 472
475 if (found_path) { 473 if (found_path) {
476 content::BrowserThread::PostTask(content::BrowserThread::IO, 474 content::BrowserThread::PostTask(content::BrowserThread::IO,
477 FROM_HERE, 475 FROM_HERE,
478 base::Bind(iter->success_callback, entry_list, false)); 476 base::Bind(iter->success_callback, entry_list, false));
479 } else { 477 } else {
480 content::BrowserThread::PostTask(content::BrowserThread::IO, 478 content::BrowserThread::PostTask(content::BrowserThread::IO,
481 FROM_HERE, 479 FROM_HERE,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 std::string device_name = base::FilePath(device_location).BaseName().value(); 560 std::string device_name = base::FilePath(device_location).BaseName().value();
563 std::string device_id; 561 std::string device_id;
564 storage_monitor::StorageInfo::Type type; 562 storage_monitor::StorageInfo::Type type;
565 bool cracked = storage_monitor::StorageInfo::CrackDeviceId( 563 bool cracked = storage_monitor::StorageInfo::CrackDeviceId(
566 device_name, &type, &device_id); 564 device_name, &type, &device_id);
567 DCHECK(cracked); 565 DCHECK(cracked);
568 DCHECK_EQ(storage_monitor::StorageInfo::MAC_IMAGE_CAPTURE, type); 566 DCHECK_EQ(storage_monitor::StorageInfo::MAC_IMAGE_CAPTURE, type);
569 567
570 cb.Run(new MTPDeviceDelegateImplMac(device_id, device_location)); 568 cb.Run(new MTPDeviceDelegateImplMac(device_id, device_location));
571 } 569 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698