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

Side by Side Diff: net/base/directory_lister.cc

Issue 24616002: Clean up a few unused globals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win Created 7 years, 2 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 "net/base/directory_lister.h" 5 #include "net/base/directory_lister.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/files/file_enumerator.h" 12 #include "base/files/file_enumerator.h"
13 #include "base/i18n/file_util_icu.h" 13 #include "base/i18n/file_util_icu.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/threading/thread_restrictions.h" 15 #include "base/threading/thread_restrictions.h"
16 #include "base/threading/worker_pool.h" 16 #include "base/threading/worker_pool.h"
17 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
18 18
19 namespace net { 19 namespace net {
20 20
21 namespace { 21 namespace {
22 22
23 const int kFilesPerEvent = 8;
24
25 bool IsDotDot(const base::FilePath& path) { 23 bool IsDotDot(const base::FilePath& path) {
26 return FILE_PATH_LITERAL("..") == path.BaseName().value(); 24 return FILE_PATH_LITERAL("..") == path.BaseName().value();
27 } 25 }
28 26
29 // Comparator for sorting lister results. This uses the locale aware filename 27 // Comparator for sorting lister results. This uses the locale aware filename
30 // comparison function on the filenames for sorting in the user's locale. 28 // comparison function on the filenames for sorting in the user's locale.
31 // Static. 29 // Static.
32 bool CompareAlphaDirsFirst(const DirectoryLister::DirectoryListerData& a, 30 bool CompareAlphaDirsFirst(const DirectoryLister::DirectoryListerData& a,
33 const DirectoryLister::DirectoryListerData& b) { 31 const DirectoryLister::DirectoryListerData& b) {
34 // Parent directory before all else. 32 // Parent directory before all else.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 DirectoryListerData data; 160 DirectoryListerData data;
163 data.info = file_enum.GetInfo(); 161 data.info = file_enum.GetInfo();
164 data.path = path; 162 data.path = path;
165 file_data.push_back(data); 163 file_data.push_back(data);
166 164
167 /* TODO(brettw) bug 24107: It would be nice to send incremental updates. 165 /* TODO(brettw) bug 24107: It would be nice to send incremental updates.
168 We gather them all so they can be sorted, but eventually the sorting 166 We gather them all so they can be sorted, but eventually the sorting
169 should be done from JS to give more flexibility in the page. When we do 167 should be done from JS to give more flexibility in the page. When we do
170 that, we can uncomment this to send incremental updates to the page. 168 that, we can uncomment this to send incremental updates to the page.
171 169
170 const int kFilesPerEvent = 8;
172 if (file_data.size() < kFilesPerEvent) 171 if (file_data.size() < kFilesPerEvent)
173 continue; 172 continue;
174 173
175 origin_loop_->PostTask( 174 origin_loop_->PostTask(
176 FROM_HERE, 175 FROM_HERE,
177 base::Bind(&DirectoryLister::Core::SendData, file_data)); 176 base::Bind(&DirectoryLister::Core::SendData, file_data));
178 file_data.clear(); 177 file_data.clear();
179 */ 178 */
180 } 179 }
181 180
(...skipping 24 matching lines...) Expand all
206 205
207 void DirectoryLister::OnReceivedData(const DirectoryListerData& data) { 206 void DirectoryLister::OnReceivedData(const DirectoryListerData& data) {
208 delegate_->OnListFile(data); 207 delegate_->OnListFile(data);
209 } 208 }
210 209
211 void DirectoryLister::OnDone(int error) { 210 void DirectoryLister::OnDone(int error) {
212 delegate_->OnListDone(error); 211 delegate_->OnListDone(error);
213 } 212 }
214 213
215 } // namespace net 214 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698