| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/service.h" | 5 #include "vm/service.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 | 9 |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 JSONStream js; | 946 JSONStream js; |
| 947 js.SetupNew(zone.GetZone(), SendPort::Cast(reply_port).Id(), | 947 js.SetupNew(zone.GetZone(), SendPort::Cast(reply_port).Id(), |
| 948 method, param_keys, param_values); | 948 method, param_keys, param_values); |
| 949 if (handler == NULL) { | 949 if (handler == NULL) { |
| 950 // Check for an embedder handler. | 950 // Check for an embedder handler. |
| 951 EmbedderServiceHandler* e_handler = | 951 EmbedderServiceHandler* e_handler = |
| 952 FindIsolateEmbedderHandler(method.ToCString()); | 952 FindIsolateEmbedderHandler(method.ToCString()); |
| 953 if (e_handler != NULL) { | 953 if (e_handler != NULL) { |
| 954 EmbedderHandleMessage(e_handler, &js); | 954 EmbedderHandleMessage(e_handler, &js); |
| 955 } else { | 955 } else { |
| 956 PrintError(&js, "Unrecognized method: %s", method.ToCString()); | 956 if (FindRootMessageHandlerNew(method.ToCString()) != NULL) { |
| 957 PrintError(&js, "%s expects no 'isolate' parameter\n", |
| 958 method.ToCString()); |
| 959 } else { |
| 960 PrintError(&js, "Unrecognized method: %s", method.ToCString()); |
| 961 } |
| 957 } | 962 } |
| 958 js.PostReply(); | 963 js.PostReply(); |
| 959 } else { | 964 } else { |
| 960 if (handler(isolate, &js)) { | 965 if (handler(isolate, &js)) { |
| 961 // Handler returns true if the reply is ready to be posted. | 966 // Handler returns true if the reply is ready to be posted. |
| 962 // TODO(johnmccutchan): Support asynchronous replies. | 967 // TODO(johnmccutchan): Support asynchronous replies. |
| 963 js.PostReply(); | 968 js.PostReply(); |
| 964 } | 969 } |
| 965 } | 970 } |
| 966 } | 971 } |
| (...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3078 JSONStream js; | 3083 JSONStream js; |
| 3079 js.SetupNew(zone.GetZone(), SendPort::Cast(reply_port).Id(), | 3084 js.SetupNew(zone.GetZone(), SendPort::Cast(reply_port).Id(), |
| 3080 method, param_keys, param_values); | 3085 method, param_keys, param_values); |
| 3081 if (handler == NULL) { | 3086 if (handler == NULL) { |
| 3082 // Check for an embedder handler. | 3087 // Check for an embedder handler. |
| 3083 EmbedderServiceHandler* e_handler = | 3088 EmbedderServiceHandler* e_handler = |
| 3084 FindRootEmbedderHandler(method.ToCString()); | 3089 FindRootEmbedderHandler(method.ToCString()); |
| 3085 if (e_handler != NULL) { | 3090 if (e_handler != NULL) { |
| 3086 EmbedderHandleMessage(e_handler, &js); | 3091 EmbedderHandleMessage(e_handler, &js); |
| 3087 } else { | 3092 } else { |
| 3088 PrintError(&js, "Unrecognized path"); | 3093 if (FindIsolateMessageHandlerNew(method.ToCString()) != NULL) { |
| 3094 PrintError(&js, "%s expects an 'isolate' parameter\n", |
| 3095 method.ToCString()); |
| 3096 } else { |
| 3097 PrintError(&js, "Unrecognized method: %s", method.ToCString()); |
| 3098 } |
| 3089 } | 3099 } |
| 3090 js.PostReply(); | 3100 js.PostReply(); |
| 3091 } else { | 3101 } else { |
| 3092 if (handler(&js)) { | 3102 if (handler(&js)) { |
| 3093 // Handler returns true if the reply is ready to be posted. | 3103 // Handler returns true if the reply is ready to be posted. |
| 3094 // TODO(johnmccutchan): Support asynchronous replies. | 3104 // TODO(johnmccutchan): Support asynchronous replies. |
| 3095 js.PostReply(); | 3105 js.PostReply(); |
| 3096 } | 3106 } |
| 3097 } | 3107 } |
| 3098 } | 3108 } |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3480 while (current != NULL) { | 3490 while (current != NULL) { |
| 3481 if (strcmp(name, current->name()) == 0) { | 3491 if (strcmp(name, current->name()) == 0) { |
| 3482 return current; | 3492 return current; |
| 3483 } | 3493 } |
| 3484 current = current->next(); | 3494 current = current->next(); |
| 3485 } | 3495 } |
| 3486 return NULL; | 3496 return NULL; |
| 3487 } | 3497 } |
| 3488 | 3498 |
| 3489 } // namespace dart | 3499 } // namespace dart |
| OLD | NEW |