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

Side by Side Diff: runtime/bin/directory_win.cc

Issue 45833003: Fix directory-listing to return a future on cancel. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix reporting of immediate errors from directory listing. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/directory_macos.cc ('k') | sdk/lib/io/directory_impl.dart » ('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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include "bin/directory.h" 8 #include "bin/directory.h"
9 #include "bin/file.h" 9 #include "bin/file.h"
10 #include "bin/utils.h" 10 #include "bin/utils.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 if (FindNextFileW(reinterpret_cast<HANDLE>(lister_), &find_file_data) != 0) { 199 if (FindNextFileW(reinterpret_cast<HANDLE>(lister_), &find_file_data) != 0) {
200 return HandleFindFile(listing, this, find_file_data); 200 return HandleFindFile(listing, this, find_file_data);
201 } 201 }
202 202
203 done_ = true; 203 done_ = true;
204 204
205 if (GetLastError() != ERROR_NO_MORE_FILES) { 205 if (GetLastError() != ERROR_NO_MORE_FILES) {
206 return kListError; 206 return kListError;
207 } 207 }
208 208
209 if (FindClose(reinterpret_cast<HANDLE>(lister_)) == 0) {
210 return kListError;
211 }
212
213 return kListDone; 209 return kListDone;
214 } 210 }
215 211
216 212
213 DirectoryListingEntry::~DirectoryListingEntry() {
214 ResetLink();
215 if (lister_ != 0) {
216 FindClose(reinterpret_cast<HANDLE>(lister_));
217 }
218 }
219
220
217 void DirectoryListingEntry::ResetLink() { 221 void DirectoryListingEntry::ResetLink() {
218 if (link_ != NULL && (parent_ == NULL || parent_->link_ != link_)) { 222 if (link_ != NULL && (parent_ == NULL || parent_->link_ != link_)) {
219 delete link_; 223 delete link_;
220 link_ = NULL; 224 link_ = NULL;
221 } 225 }
222 if (parent_ != NULL) { 226 if (parent_ != NULL) {
223 link_ = parent_->link_; 227 link_ = parent_->link_;
224 } 228 }
225 } 229 }
226 230
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 MoveFileExW(system_path, system_new_path, flags); 470 MoveFileExW(system_path, system_new_path, flags);
467 free(const_cast<wchar_t*>(system_path)); 471 free(const_cast<wchar_t*>(system_path));
468 free(const_cast<wchar_t*>(system_new_path)); 472 free(const_cast<wchar_t*>(system_new_path));
469 return (move_status != 0); 473 return (move_status != 0);
470 } 474 }
471 475
472 } // namespace bin 476 } // namespace bin
473 } // namespace dart 477 } // namespace dart
474 478
475 #endif // defined(TARGET_OS_WINDOWS) 479 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « runtime/bin/directory_macos.cc ('k') | sdk/lib/io/directory_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698