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

Side by Side Diff: chrome/browser/chromeos/drive/fileapi/fileapi_worker.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
« no previous file with comments | « no previous file | chrome/browser/chromeos/file_system_provider/fake_provided_file_system.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/drive/fileapi/fileapi_worker.h" 5 #include "chrome/browser/chromeos/drive/fileapi/fileapi_worker.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/task_runner_util.h" 9 #include "base/task_runner_util.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 std::vector<storage::DirectoryEntry> entries; 75 std::vector<storage::DirectoryEntry> entries;
76 // Convert drive files to File API's directory entry. 76 // Convert drive files to File API's directory entry.
77 entries.reserve(resource_entries->size()); 77 entries.reserve(resource_entries->size());
78 for (size_t i = 0; i < resource_entries->size(); ++i) { 78 for (size_t i = 0; i < resource_entries->size(); ++i) {
79 const ResourceEntry& resource_entry = (*resource_entries)[i]; 79 const ResourceEntry& resource_entry = (*resource_entries)[i];
80 storage::DirectoryEntry entry; 80 storage::DirectoryEntry entry;
81 entry.name = resource_entry.base_name(); 81 entry.name = resource_entry.base_name();
82 82
83 const PlatformFileInfoProto& file_info = resource_entry.file_info(); 83 const PlatformFileInfoProto& file_info = resource_entry.file_info();
84 entry.is_directory = file_info.is_directory(); 84 entry.is_directory = file_info.is_directory();
85 entry.size = file_info.size();
86 entry.last_modified_time =
87 base::Time::FromInternalValue(file_info.last_modified());
88 entries.push_back(entry); 85 entries.push_back(entry);
89 } 86 }
90 87
91 callback.Run(base::File::FILE_OK, entries, true /*has_more*/); 88 callback.Run(base::File::FILE_OK, entries, true /*has_more*/);
92 } 89 }
93 90
94 // Runs |callback| with |error|. 91 // Runs |callback| with |error|.
95 void RunReadDirectoryCallbackOnCompletion(const ReadDirectoryCallback& callback, 92 void RunReadDirectoryCallbackOnCompletion(const ReadDirectoryCallback& callback,
96 FileError error) { 93 FileError error) {
97 callback.Run(FileErrorToBaseFileError(error), 94 callback.Run(FileErrorToBaseFileError(error),
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 const StatusCallback& callback, 358 const StatusCallback& callback,
362 FileSystemInterface* file_system) { 359 FileSystemInterface* file_system) {
363 DCHECK_CURRENTLY_ON(BrowserThread::UI); 360 DCHECK_CURRENTLY_ON(BrowserThread::UI);
364 file_system->TouchFile(file_path, last_access_time, last_modified_time, 361 file_system->TouchFile(file_path, last_access_time, last_modified_time,
365 base::Bind(&RunStatusCallbackByFileError, callback)); 362 base::Bind(&RunStatusCallbackByFileError, callback));
366 363
367 } 364 }
368 365
369 } // namespace fileapi_internal 366 } // namespace fileapi_internal
370 } // namespace drive 367 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/file_system_provider/fake_provided_file_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698