OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 #ifndef VM_DEV_FS_H_ |
| 6 #define VM_DEV_FS_H_ |
| 7 |
| 8 #include "vm/globals.h" |
| 9 |
| 10 #include "vm/dart_api_impl.h" |
| 11 |
| 12 namespace dart { |
| 13 |
| 14 class Array; |
| 15 class FileSystem; |
| 16 class JSONStream; |
| 17 class Mutex; |
| 18 class ObjectPointerVisitor; |
| 19 class RawArray; |
| 20 class RawObject; |
| 21 class String; |
| 22 |
| 23 |
| 24 // Manages dart-devfs:// file systems. These file systems are "virtual" |
| 25 // and accessed via the service protocol. |
| 26 class DevFS { |
| 27 public: |
| 28 static void Init(); |
| 29 static void Cleanup(); |
| 30 |
| 31 static void ListFileSystems(JSONStream* js); |
| 32 static void CreateFileSystem(JSONStream* js, const String& fs_name); |
| 33 static void DeleteFileSystem(JSONStream* js, const String& fs_name); |
| 34 static void ListFiles(JSONStream* js, |
| 35 const String& fs_name); |
| 36 static void WriteFiles(JSONStream* js, |
| 37 const String& fs_name, |
| 38 const Array& files); |
| 39 static void WriteFile(JSONStream* js, |
| 40 const String& fs_name, |
| 41 const String& path, |
| 42 const String& file_contents); |
| 43 // Does not assume that |file_contents| is a base64 encoded string. |
| 44 static void WriteFileRaw(JSONStream* js, |
| 45 const String& fs_name, |
| 46 const String& path, |
| 47 const String& file_contents); |
| 48 static void ReadFile(JSONStream* js, |
| 49 const String& fs_name, |
| 50 const String& path); |
| 51 |
| 52 static Dart_Handle ReadFile(const char* fs_name, |
| 53 const char* path); |
| 54 |
| 55 static Dart_Handle ReadFileAsString(const char* fs_name, |
| 56 const char* path); |
| 57 |
| 58 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, |
| 59 Dart_Handle library, |
| 60 Dart_Handle url); |
| 61 |
| 62 private: |
| 63 static Mutex* mutex_; |
| 64 static FileSystem* LookupFileSystem(const String& fs_name); |
| 65 static FileSystem* LookupFileSystem(const char* fs_name); |
| 66 }; |
| 67 |
| 68 } // namespace dart |
| 69 |
| 70 #endif // VM_DEV_FS_H_ |
OLD | NEW |