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

Unified Diff: sdk/lib/vmservice/devfs.dart

Issue 2225583002: Support devFS writes via HTTP PUT (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rmacnak review Created 4 years, 4 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/observatory/tests/service/dev_fs_http_put_test.dart ('k') | sdk/lib/vmservice/message.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/vmservice/devfs.dart
diff --git a/sdk/lib/vmservice/devfs.dart b/sdk/lib/vmservice/devfs.dart
index 47355127ed5367aca4da4bc1d5a47103e7c28543..7f940b9a572180831be475cc0f5855cc61da0403 100644
--- a/sdk/lib/vmservice/devfs.dart
+++ b/sdk/lib/vmservice/devfs.dart
@@ -121,6 +121,39 @@ class DevFS {
}
}
+ Future<String> handlePutStream(Object fsName,
+ Object path,
+ Stream<List<int>> bytes) async {
+ // A dummy Message for error message construction.
+ Message message = new Message.forMethod('_writeDevFSFile');
+ var writeStreamFile = VMServiceEmbedderHooks.writeStreamFile;
+ if (writeStreamFile == null) {
+ return _encodeDevFSDisabledError(message);
+ }
+ if (fsName == null) {
+ return encodeMissingParamError(message, 'fsName');
+ }
+ if (fsName is! String) {
+ return encodeInvalidParamError(message, 'fsName');
+ }
+ var fs = _fsMap[fsName];
+ if (fs == null) {
+ return _encodeFileSystemDoesNotExistError(message, fsName);
+ }
+ if (path == null) {
+ return encodeMissingParamError(message, 'path');
+ }
+ if (path is! String) {
+ return encodeInvalidParamError(message, 'path');
+ }
+ Uri uri = fs.resolvePath(path);
+ if (uri == null) {
+ return encodeInvalidParamError(message, 'path');
+ }
+ await writeStreamFile(uri, bytes);
+ return encodeSuccess(message);
+ }
+
Future<String> _listDevFS(Message message) async {
var result = {};
result['type'] = 'FileSystemList';
« no previous file with comments | « runtime/observatory/tests/service/dev_fs_http_put_test.dart ('k') | sdk/lib/vmservice/message.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698