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

Unified Diff: runtime/vm/service.cc

Issue 2254543006: Reduce copying in sending service responses. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: dbc, sync 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/vm/json_stream.cc ('k') | runtime/vm/service_test.cc » ('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 a6864b3f84b5d3aa7defc0e3cdbf76fddcc93454..ba3effa51f934bbf7250346d7adf8d447ec49232 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -29,6 +29,7 @@
#include "vm/port.h"
#include "vm/profiler_service.h"
#include "vm/reusable_handles.h"
+#include "vm/safepoint.h"
#include "vm/service_event.h"
#include "vm/service_isolate.h"
#include "vm/source_report.h"
@@ -838,6 +839,7 @@ void Service::InvokeMethod(Isolate* I,
Thread* T = Thread::Current();
ASSERT(I == T->isolate());
ASSERT(I != NULL);
+ ASSERT(T->execution_state() == Thread::kThreadInVM);
ASSERT(!msg.IsNull());
ASSERT(msg.Length() == 6);
@@ -1195,8 +1197,12 @@ void Service::EmbedderHandleMessage(EmbedderServiceHandler* handler,
Dart_ServiceRequestCallback callback = handler->callback();
ASSERT(callback != NULL);
const char* response = NULL;
- bool success = callback(js->method(), js->param_keys(), js->param_values(),
- js->num_params(), handler->user_data(), &response);
+ bool success;
+ {
+ TransitionVMToNative transition(Thread::Current());
+ success = callback(js->method(), js->param_keys(), js->param_values(),
+ js->num_params(), handler->user_data(), &response);
+ }
ASSERT(response != NULL);
if (!success) {
js->SetupError();
« no previous file with comments | « runtime/vm/json_stream.cc ('k') | runtime/vm/service_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698