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

Side by Side Diff: chrome/browser/file_select_helper_mac.mm

Issue 2679993002: Run FileSelectHelper::ProcessSelectedFilesMac in parallel in TaskScheduler. (Closed)
Patch Set: include Created 3 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/file_select_helper.cc ('k') | no next file » | 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/file_select_helper.h" 5 #include "chrome/browser/file_select_helper.h"
6 6
7 #include <Cocoa/Cocoa.h> 7 #include <Cocoa/Cocoa.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 9
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 int result = -1; 82 int result = -1;
83 if (success) 83 if (success)
84 result = fchmod(file.GetPlatformFile(), S_IRUSR); 84 result = fchmod(file.GetPlatformFile(), S_IRUSR);
85 85
86 return result >= 0 ? dest : base::FilePath(); 86 return result >= 0 ? dest : base::FilePath();
87 } 87 }
88 88
89 void FileSelectHelper::ProcessSelectedFilesMac( 89 void FileSelectHelper::ProcessSelectedFilesMac(
90 const std::vector<ui::SelectedFileInfo>& files) { 90 const std::vector<ui::SelectedFileInfo>& files) {
91 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE_USER_BLOCKING);
92
93 // Make a mutable copy of the input files. 91 // Make a mutable copy of the input files.
94 std::vector<ui::SelectedFileInfo> files_out(files); 92 std::vector<ui::SelectedFileInfo> files_out(files);
95 std::vector<base::FilePath> temporary_files; 93 std::vector<base::FilePath> temporary_files;
96 94
97 for (auto& file_info : files_out) { 95 for (auto& file_info : files_out) {
98 NSString* filename = base::mac::FilePathToNSString(file_info.local_path); 96 NSString* filename = base::mac::FilePathToNSString(file_info.local_path);
99 BOOL isPackage = 97 BOOL isPackage =
100 [[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename]; 98 [[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename];
101 if (isPackage && base::DirectoryExists(file_info.local_path)) { 99 if (isPackage && base::DirectoryExists(file_info.local_path)) {
102 base::FilePath result = ZipPackage(file_info.local_path); 100 base::FilePath result = ZipPackage(file_info.local_path);
(...skipping 30 matching lines...) Expand all
133 // need to be deleted now. 131 // need to be deleted now.
134 if (!web_contents_) { 132 if (!web_contents_) {
135 DeleteTemporaryFiles(); 133 DeleteTemporaryFiles();
136 RunFileChooserEnd(); 134 RunFileChooserEnd();
137 return; 135 return;
138 } 136 }
139 } 137 }
140 138
141 NotifyRenderFrameHostAndEnd(files); 139 NotifyRenderFrameHostAndEnd(files);
142 } 140 }
OLDNEW
« no previous file with comments | « chrome/browser/file_select_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698