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

Unified Diff: runtime/bin/directory.h

Issue 9310082: Run all directory async operations on a separate thread using native ports (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adderssed review comments from ager@ (and rebased) Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/builtin_natives.cc ('k') | runtime/bin/directory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory.h
diff --git a/runtime/bin/directory.h b/runtime/bin/directory.h
index 0350fc0a86868abdab94041a09d1e8ca6d0fffd0..16c8443f383099a5c875e3e86ac1482d94a17261 100644
--- a/runtime/bin/directory.h
+++ b/runtime/bin/directory.h
@@ -6,8 +6,32 @@
#define BIN_DIRECTORY_H_
#include "bin/builtin.h"
+#include "bin/dartutils.h"
#include "platform/globals.h"
+class DirectoryListing {
+ public:
+ enum Response {
+ kListDirectory = 0,
+ kListFile = 1,
+ kListError = 2,
+ kListDone = 3
+ };
+
+ explicit DirectoryListing(Dart_Port response_port)
+ : response_port_(response_port) {}
+ bool HandleDirectory(char* dir_name);
+ bool HandleFile(char* file_name);
+ bool HandleError(char* message);
+
+ private:
+ CObjectArray* NewResponse(Response response, char* arg);
+ Dart_Port response_port_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(DirectoryListing);
+};
+
+
class Directory {
public:
enum ExistsResult {
@@ -16,12 +40,17 @@ class Directory {
DOES_NOT_EXIST
};
- static void List(const char* path,
+ enum DirectoryRequest {
+ kCreateRequest = 0,
+ kDeleteRequest = 1,
+ kExistsRequest = 2,
+ kCreateTempRequest = 3,
+ kListRequest = 4
+ };
+
+ static bool List(const char* path,
bool recursive,
- Dart_Port dir_port,
- Dart_Port file_port,
- Dart_Port done_port,
- Dart_Port error_port);
+ DirectoryListing* listing);
static ExistsResult Exists(const char* path);
@@ -38,4 +67,5 @@ class Directory {
DISALLOW_IMPLICIT_CONSTRUCTORS(Directory);
};
+
#endif // BIN_DIRECTORY_H_
« no previous file with comments | « runtime/bin/builtin_natives.cc ('k') | runtime/bin/directory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698