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

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

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
« no previous file with comments | « runtime/vm/vm_sources.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/vmservice/message.dart
diff --git a/sdk/lib/vmservice/message.dart b/sdk/lib/vmservice/message.dart
index 481206e6eb6ebe118e6f6649d79dbc66e1f64bb1..08bb5b1a56343c156e1a39b10f84ef2ef76cbfa7 100644
--- a/sdk/lib/vmservice/message.dart
+++ b/sdk/lib/vmservice/message.dart
@@ -116,23 +116,58 @@ class Message {
return _completer.future;
}
+ // We currently support two ways of passing parameters from Dart code to C
+ // code. The original way always converts the parameters to strings before
+ // passing them over. Our goal is to convert all C handlers to take the
+ // parameters as Dart objects but until the conversion is complete, we
+ // maintain the list of supported methods below.
+ bool _methodNeedsObjectParameters(String method) {
+ switch (method) {
+ case '_listDevFS':
+ case '_listDevFSFiles':
+ case '_createDevFS':
+ case '_deleteDevFS':
+ case '_writeDevFSFile':
+ case '_writeDevFSFiles':
+ case '_readDevFSFile':
+ return true;
+ default:
+ return false;
+ }
+ }
+
Future<String> sendToVM() {
final receivePort = new RawReceivePort();
receivePort.handler = (value) {
receivePort.close();
_completer.complete(value);
};
- var keys = _makeAllString(params.keys.toList(growable:false));
- var values = _makeAllString(params.values.toList(growable:false));
- var request = new List(6)
- ..[0] = 0 // Make room for OOB message type.
- ..[1] = receivePort.sendPort
- ..[2] = serial
- ..[3] = method
- ..[4] = keys
- ..[5] = values;
- sendRootServiceMessage(request);
- return _completer.future;
+ if (_methodNeedsObjectParameters(method)) {
+ // We use a different method invocation path here.
+ var keys = params.keys.toList(growable:false);
+ var values = params.values.toList(growable:false);
+ var request = new List(6)
+ ..[0] = 0 // Make room for OOB message type.
+ ..[1] = receivePort.sendPort
+ ..[2] = serial
+ ..[3] = method
+ ..[4] = keys
+ ..[5] = values;
+ sendObjectRootServiceMessage(request);
+ return _completer.future;
+ } else {
+ var keys = _makeAllString(params.keys.toList(growable:false));
+ var values = _makeAllString(params.values.toList(growable:false));
+ var request = new List(6)
+ ..[0] = 0 // Make room for OOB message type.
+ ..[1] = receivePort.sendPort
+ ..[2] = serial
+ ..[3] = method
+ ..[4] = keys
+ ..[5] = values;
+ sendRootServiceMessage(request);
+ return _completer.future;
+ }
}
void setResponse(String response) {
@@ -147,3 +182,4 @@ class Message {
external bool sendIsolateServiceMessage(SendPort sp, List m);
external void sendRootServiceMessage(List m);
+external void sendObjectRootServiceMessage(List m);
« no previous file with comments | « runtime/vm/vm_sources.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698