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

Side by Side Diff: chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc

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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // MTPDeviceDelegateImplWin implementation. 5 // MTPDeviceDelegateImplWin implementation.
6 6
7 #include "chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h" 7 #include "chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h"
8 8
9 #include <portabledevice.h> 9 #include <portabledevice.h>
10 10
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 base::FilePath current; 196 base::FilePath current;
197 scoped_ptr<MTPDeviceObjectEnumerator> file_enum = 197 scoped_ptr<MTPDeviceObjectEnumerator> file_enum =
198 CreateFileEnumeratorOnBlockingPoolThread(device_info, root); 198 CreateFileEnumeratorOnBlockingPoolThread(device_info, root);
199 if (!file_enum) 199 if (!file_enum)
200 return error; 200 return error;
201 201
202 while (!(current = file_enum->Next()).empty()) { 202 while (!(current = file_enum->Next()).empty()) {
203 storage::DirectoryEntry entry; 203 storage::DirectoryEntry entry;
204 entry.is_directory = file_enum->IsDirectory(); 204 entry.is_directory = file_enum->IsDirectory();
205 entry.name = storage::VirtualPath::BaseName(current).value(); 205 entry.name = storage::VirtualPath::BaseName(current).value();
206 entry.size = file_enum->Size();
207 entry.last_modified_time = file_enum->LastModifiedTime();
208 entries->push_back(entry); 206 entries->push_back(entry);
209 } 207 }
210 return error; 208 return error;
211 } 209 }
212 210
213 // Gets the device file stream object on a blocking pool thread. 211 // Gets the device file stream object on a blocking pool thread.
214 // |device_info| contains the device storage partition details. 212 // |device_info| contains the device storage partition details.
215 // On success, returns base::File::FILE_OK and file stream details are set in 213 // On success, returns base::File::FILE_OK and file stream details are set in
216 // |file_details|. On failure, returns a platform file error and file stream 214 // |file_details|. On failure, returns a platform file error and file stream
217 // details are not set in |file_details|. 215 // details are not set in |file_details|.
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 current_snapshot_details_->file_info(), 692 current_snapshot_details_->file_info(),
695 current_snapshot_details_->request_info().snapshot_file_path); 693 current_snapshot_details_->request_info().snapshot_file_path);
696 } else { 694 } else {
697 current_snapshot_details_->request_info().error_callback.Run( 695 current_snapshot_details_->request_info().error_callback.Run(
698 base::File::FILE_ERROR_FAILED); 696 base::File::FILE_ERROR_FAILED);
699 } 697 }
700 task_in_progress_ = false; 698 task_in_progress_ = false;
701 current_snapshot_details_.reset(); 699 current_snapshot_details_.reset();
702 ProcessNextPendingRequest(); 700 ProcessNextPendingRequest();
703 } 701 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698