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

Unified Diff: runtime/vm/service.cc

Issue 1282883003: Move service extension handler execution to a timer (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/service.h ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 3868b9ca7dd8ad18ef946a3f5d6da57e66553e73..89639cccdd9583ce0b8790dfc1a90271fb77cfc6 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -585,13 +585,13 @@ void Service::InvokeMethod(Isolate* isolate, const Array& msg) {
return;
}
- if (ExtensionHandlerExists(method_name)) {
- InvokeExtensionHandler(method_name,
- param_keys,
- param_values,
- reply_port,
- seq);
- // The reply is posted asynchronously.
+ if (ScheduleExtensionHandler(method_name,
+ param_keys,
+ param_values,
+ reply_port,
+ seq)) {
+ // Schedule was successful. Extension code will post a reply
+ // asynchronously.
return;
}
@@ -879,42 +879,27 @@ EmbedderServiceHandler* Service::FindRootEmbedderHandler(
}
-bool Service::ExtensionHandlerExists(const String& method) {
- ASSERT(!method.IsNull());
- const Library& developer_lib = Library::Handle(Library::DeveloperLibrary());
- ASSERT(!developer_lib.IsNull());
- const Function& extension_exists = Function::Handle(
- developer_lib.LookupLocalFunction(Symbols::_extensionExists()));
- ASSERT(!extension_exists.IsNull());
- const Array& arguments = Array::Handle(Array::New(1));
- ASSERT(!arguments.IsNull());
- arguments.SetAt(0, method);
- return (DartEntry::InvokeFunction(extension_exists, arguments) ==
- Object::bool_true().raw());
-}
-
-
-bool Service::InvokeExtensionHandler(const String& method_name,
- const Array& parameter_keys,
- const Array& parameter_values,
- const Instance& reply_port,
- const Instance& id) {
+bool Service::ScheduleExtensionHandler(const String& method_name,
+ const Array& parameter_keys,
+ const Array& parameter_values,
+ const Instance& reply_port,
+ const Instance& id) {
ASSERT(!method_name.IsNull());
ASSERT(!parameter_keys.IsNull());
ASSERT(!parameter_values.IsNull());
ASSERT(!reply_port.IsNull());
const Library& developer_lib = Library::Handle(Library::DeveloperLibrary());
ASSERT(!developer_lib.IsNull());
- const Function& invoke_extension = Function::Handle(
- developer_lib.LookupLocalFunction(Symbols::_invokeExtension()));
- ASSERT(!invoke_extension.IsNull());
+ const Function& schedule_extension = Function::Handle(
+ developer_lib.LookupLocalFunction(Symbols::_scheduleExtension()));
+ ASSERT(!schedule_extension.IsNull());
const Array& arguments = Array::Handle(Array::New(5));
arguments.SetAt(0, method_name);
arguments.SetAt(1, parameter_keys);
arguments.SetAt(2, parameter_values);
arguments.SetAt(3, reply_port);
arguments.SetAt(4, id);
- return (DartEntry::InvokeFunction(invoke_extension, arguments) ==
+ return (DartEntry::InvokeFunction(schedule_extension, arguments) ==
Object::bool_true().raw());
}
« no previous file with comments | « runtime/vm/service.h ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698