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

Unified Diff: runtime/vm/dev_fs.h

Issue 2059883003: DevFS initial implementation (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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/vm/dev_fs.h
diff --git a/runtime/vm/dev_fs.h b/runtime/vm/dev_fs.h
new file mode 100644
index 0000000000000000000000000000000000000000..c55656162f80a4d9c41e14f47d84155a34db40a1
--- /dev/null
+++ b/runtime/vm/dev_fs.h
@@ -0,0 +1,70 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef VM_DEV_FS_H_
+#define VM_DEV_FS_H_
+
+#include "vm/globals.h"
+
+#include "vm/dart_api_impl.h"
+
+namespace dart {
+
+class Array;
+class FileSystem;
+class JSONStream;
+class Mutex;
+class ObjectPointerVisitor;
+class RawArray;
+class RawObject;
+class String;
+
+
+// Manages dart-devfs:// file systems. These file systems are "virtual"
+// and accessed via the service protocol.
+class DevFS {
+ public:
+ static void Init();
+ static void Cleanup();
+
+ static void ListFileSystems(JSONStream* js);
+ static void CreateFileSystem(JSONStream* js, const String& fs_name);
+ static void DeleteFileSystem(JSONStream* js, const String& fs_name);
+ static void ListFiles(JSONStream* js,
+ const String& fs_name);
+ static void WriteFiles(JSONStream* js,
+ const String& fs_name,
+ const Array& files);
+ static void WriteFile(JSONStream* js,
+ const String& fs_name,
+ const String& path,
+ const String& file_contents);
+ // Does not assume that |file_contents| is a base64 encoded string.
+ static void WriteFileRaw(JSONStream* js,
+ const String& fs_name,
+ const String& path,
+ const String& file_contents);
+ static void ReadFile(JSONStream* js,
+ const String& fs_name,
+ const String& path);
+
+ static Dart_Handle ReadFile(const char* fs_name,
+ const char* path);
+
+ static Dart_Handle ReadFileAsString(const char* fs_name,
+ const char* path);
+
+ static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
+ Dart_Handle library,
+ Dart_Handle url);
+
+ private:
+ static Mutex* mutex_;
+ static FileSystem* LookupFileSystem(const String& fs_name);
+ static FileSystem* LookupFileSystem(const char* fs_name);
+};
+
+} // namespace dart
+
+#endif // VM_DEV_FS_H_

Powered by Google App Engine
This is Rietveld 408576698