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

Unified Diff: runtime/bin/directory_win.cc

Issue 8509002: Revert "Post on the error handler in the Directory API when errors are encountered." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/directory_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory_win.cc
diff --git a/runtime/bin/directory_win.cc b/runtime/bin/directory_win.cc
index 1c6506849ce5125cd4f45fd6ad0d641976e6eefa..d3adfb83e46e3fbc19e026017d6b1a8249f4314c 100644
--- a/runtime/bin/directory_win.cc
+++ b/runtime/bin/directory_win.cc
@@ -106,30 +106,6 @@ static void ComputeFullSearchPath(const char* dir_name,
*path_length += written;
}
-static void PostError(Dart_Port error_port,
- const char* prefix,
- const char* suffix) {
- if (error_port != 0) {
- static const int kBufferSize = 10;
- char error_str[kBufferSize];
- int written = snprintf(error_str, kBufferSize, "%d", GetLastError());
- ASSERT(written < kBufferSize);
- int error_message_size =
- strlen(prefix) + strlen(suffix) + strlen(error_str) + 3;
- char* message = static_cast<char*>(malloc(error_message_size + 1));
- written = snprintf(message,
- error_message_size + 1,
- "%s%s (%s)",
- prefix,
- suffix,
- error_str);
- ASSERT(written == error_message_size);
- Dart_Post(error_port, Dart_NewString(message));
- free(message);
- }
-}
-
-
static bool ListRecursively(const char* dir_name,
bool recursive,
Dart_Port dir_port,
@@ -148,42 +124,38 @@ static bool ListRecursively(const char* dir_name,
path[path_length] = '\0';
if (find_handle == INVALID_HANDLE_VALUE) {
- PostError(error_port, "Directory listing failed for: ", path);
+ // TODO(ager): Post on error port.
free(path);
return false;
}
- bool listing_error = !HandleEntry(&find_file_data,
- path,
- path_length,
- recursive,
- dir_port,
- file_port,
- done_port,
- error_port);
-
- while ((FindNextFile(find_handle, &find_file_data) != 0) && !listing_error) {
- listing_error = listing_error || !HandleEntry(&find_file_data,
- path,
- path_length,
- recursive,
- dir_port,
- file_port,
- done_port,
- error_port);
+ bool completed = HandleEntry(&find_file_data,
+ path,
+ path_length,
+ recursive,
+ dir_port,
+ file_port,
+ done_port,
+ error_port);
+
+ while (FindNextFile(find_handle, &find_file_data) != 0) {
+ completed = completed && HandleEntry(&find_file_data,
+ path,
+ path_length,
+ recursive,
+ dir_port,
+ file_port,
+ done_port,
+ error_port);
}
- if (GetLastError() != ERROR_NO_MORE_FILES) {
- listing_error = true;
- PostError(error_port, "Directory listing failed", "");
- }
+ completed = completed && (GetLastError() == ERROR_NO_MORE_FILES);
- if (FindClose(find_handle) == 0) {
- PostError(error_port, "Failed to close directory", "");
- }
+ // TODO(ager): Post on error port if close fails.
+ FindClose(find_handle);
free(path);
- return !listing_error;
+ return completed;
}
« no previous file with comments | « runtime/bin/directory_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698