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

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: Ported to Windows 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
Index: runtime/bin/directory.h
diff --git a/runtime/bin/directory.h b/runtime/bin/directory.h
index 0350fc0a86868abdab94041a09d1e8ca6d0fffd0..5387f0cab8e68a929909ad4046ccf15b870e871a 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);
Mads Ager (google) 2012/02/20 12:56:38 Placement of '*'
Søren Gjesse 2012/02/21 11:23:24 Done.
static ExistsResult Exists(const char* path);
@@ -38,4 +67,5 @@ class Directory {
DISALLOW_IMPLICIT_CONSTRUCTORS(Directory);
};
+
#endif // BIN_DIRECTORY_H_

Powered by Google App Engine
This is Rietveld 408576698