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

Side by Side Diff: runtime/vm/service.cc

Issue 1299493007: Rework service extensions to be safe (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
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 "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 10
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 ASSERT(!developer_lib.IsNull()); 898 ASSERT(!developer_lib.IsNull());
899 const Function& schedule_extension = Function::Handle( 899 const Function& schedule_extension = Function::Handle(
900 developer_lib.LookupLocalFunction(Symbols::_scheduleExtension())); 900 developer_lib.LookupLocalFunction(Symbols::_scheduleExtension()));
901 ASSERT(!schedule_extension.IsNull()); 901 ASSERT(!schedule_extension.IsNull());
902 const Array& arguments = Array::Handle(Array::New(5)); 902 const Array& arguments = Array::Handle(Array::New(5));
903 arguments.SetAt(0, method_name); 903 arguments.SetAt(0, method_name);
904 arguments.SetAt(1, parameter_keys); 904 arguments.SetAt(1, parameter_keys);
905 arguments.SetAt(2, parameter_values); 905 arguments.SetAt(2, parameter_values);
906 arguments.SetAt(3, reply_port); 906 arguments.SetAt(3, reply_port);
907 arguments.SetAt(4, id); 907 arguments.SetAt(4, id);
908 return (DartEntry::InvokeFunction(schedule_extension, arguments) == 908 const Object& result = Object::Handle(
909 Object::bool_true().raw()); 909 DartEntry::InvokeFunction(schedule_extension, arguments));
910 if (result.IsNull()) {
911 return false;
912 }
913 Isolate* isolate = Isolate::Current();
914 isolate->AppendExtensionCall(Instance::Cast(result));
915 return true;
910 } 916 }
911 917
912 918
913 static const MethodParameter* get_isolate_params[] = { 919 static const MethodParameter* get_isolate_params[] = {
914 ISOLATE_PARAMETER, 920 ISOLATE_PARAMETER,
915 NULL, 921 NULL,
916 }; 922 };
917 923
918 924
919 static bool GetIsolate(Isolate* isolate, JSONStream* js) { 925 static bool GetIsolate(Isolate* isolate, JSONStream* js) {
(...skipping 2214 matching lines...) Expand 10 before | Expand all | Expand 10 after
3134 ServiceMethodDescriptor& method = service_methods_[i]; 3140 ServiceMethodDescriptor& method = service_methods_[i];
3135 if (strcmp(method_name, method.name) == 0) { 3141 if (strcmp(method_name, method.name) == 0) {
3136 return &method; 3142 return &method;
3137 } 3143 }
3138 } 3144 }
3139 return NULL; 3145 return NULL;
3140 } 3146 }
3141 3147
3142 3148
3143 } // namespace dart 3149 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698