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

Unified Diff: runtime/bin/directory.cc

Issue 8244001: Clean up directory listing interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/directory.cc
diff --git a/runtime/bin/directory.cc b/runtime/bin/directory.cc
index ca9448a92404633872de282bbc4da17182d3b571..d600f3df935d5fba08910b18008eceb2797c7328 100644
--- a/runtime/bin/directory.cc
+++ b/runtime/bin/directory.cc
@@ -7,36 +7,6 @@
#include "include/dart_api.h"
-void FUNCTION_NAME(Directory_Open)(Dart_NativeArguments args) {
- Dart_EnterScope();
- Dart_Handle directory_handle = Dart_GetNativeArgument(args, 0);
- Dart_Handle path_handle = Dart_GetNativeArgument(args, 1);
- if (!Dart_IsString(path_handle)) {
- Dart_SetReturnValue(args, Dart_NewBoolean(false));
- } else {
- const char* path =
- DartUtils::GetStringValue(path_handle);
- intptr_t dir = 0;
- bool success = Directory::Open(path, &dir);
- if (success) {
- DartUtils::SetIntegerInstanceField(directory_handle,
- DartUtils::kIdFieldName,
- dir);
- }
- Dart_SetReturnValue(args, Dart_NewBoolean(success));
- }
- Dart_ExitScope();
-}
-
-void FUNCTION_NAME(Directory_Close)(Dart_NativeArguments args) {
- Dart_EnterScope();
- intptr_t dir = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1));
- bool success = Directory::Close(dir);
- Dart_SetReturnValue(args, Dart_NewBoolean(success));
- Dart_ExitScope();
-}
-
-
static intptr_t GetHandlerPort(Dart_Handle handle) {
if (Dart_IsNull(handle)) {
// TODO(ager): Generalize this to Directory::kInvalidId.
@@ -49,20 +19,18 @@ static intptr_t GetHandlerPort(Dart_Handle handle) {
void FUNCTION_NAME(Directory_List)(Dart_NativeArguments args) {
Dart_EnterScope();
Dart_Handle path = Dart_GetNativeArgument(args, 1);
- intptr_t dir = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2));
- bool recursive = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 3));
- Dart_Port dir_handler_port = GetHandlerPort(Dart_GetNativeArgument(args, 4));
- Dart_Port file_handler_port = GetHandlerPort(Dart_GetNativeArgument(args, 5));
- Dart_Port done_handler_port = GetHandlerPort(Dart_GetNativeArgument(args, 6));
- Dart_Port dir_error_handler_port =
- GetHandlerPort(Dart_GetNativeArgument(args, 7));
+ bool recursive = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 2));
+ Dart_Port dir_port = GetHandlerPort(Dart_GetNativeArgument(args, 3));
+ Dart_Port file_port = GetHandlerPort(Dart_GetNativeArgument(args, 4));
+ Dart_Port done_port = GetHandlerPort(Dart_GetNativeArgument(args, 5));
+ Dart_Port error_port =
+ GetHandlerPort(Dart_GetNativeArgument(args, 6));
ASSERT(Dart_IsString(path));
Directory::List(DartUtils::GetStringValue(path),
- dir,
recursive,
- dir_handler_port,
- file_handler_port,
- done_handler_port,
- dir_error_handler_port);
+ dir_port,
+ file_port,
+ done_port,
+ error_port);
Dart_ExitScope();
}
« no previous file with comments | « runtime/bin/directory.h ('k') | runtime/bin/directory.dart » ('j') | runtime/bin/directory.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698