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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 1665773004: Add necessary support functions so that embedders can implemented pause on start and exit (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 43d308eb52fae79ee2c5bb23c9905d7760d5a1c4..74a28bc58569af43a88350f43233f1ef4ae6d949 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -1365,6 +1365,74 @@ DART_EXPORT void Dart_ThreadEnableProfiling() {
}
+DART_EXPORT bool Dart_ShouldPauseOnStart() {
+ Isolate* isolate = Isolate::Current();
+ CHECK_ISOLATE(isolate);
+ return isolate->message_handler()->pause_on_start();
+}
+
+
+DART_EXPORT void Dart_SetShouldPauseOnStart(bool v) {
turnidge 2016/02/03 21:33:36 v -> value or perhaps should_pause.
Cutch 2016/02/03 23:04:04 Done.
+ Isolate* isolate = Isolate::Current();
+ CHECK_ISOLATE(isolate);
+ isolate->set_pause_isolates_flags_overridden(true);
+ return isolate->message_handler()->set_pause_on_start(v);
+}
+
+
+DART_EXPORT bool Dart_IsPausedOnStart() {
+ Isolate* isolate = Isolate::Current();
+ CHECK_ISOLATE(isolate);
+ return isolate->message_handler()->paused_on_start();
+}
+
+
+DART_EXPORT void Dart_SetPausedOnStart(bool v) {
turnidge 2016/02/03 21:33:36 v -> value or paused, here and below.
Cutch 2016/02/03 23:04:04 Done.
+ Isolate* isolate = Isolate::Current();
+ CHECK_ISOLATE(isolate);
+ if (isolate->message_handler()->paused_on_start() != v) {
+ isolate->message_handler()->PausedOnStart(v);
+ if (v) {
+ isolate->message_handler()->NotifyPauseOnStart();
+ }
+ }
turnidge 2016/02/03 21:33:36 As discussed offline, consider making a single api
Cutch 2016/02/03 23:04:04 Done.
+}
+
+
+DART_EXPORT bool Dart_ShouldPauseOnExit() {
+ Isolate* isolate = Isolate::Current();
+ CHECK_ISOLATE(isolate);
+ return isolate->message_handler()->pause_on_exit();
+}
+
+
+DART_EXPORT void Dart_SetShouldPauseOnExit(bool v) {
+ Isolate* isolate = Isolate::Current();
+ CHECK_ISOLATE(isolate);
+ isolate->set_pause_isolates_flags_overridden(true);
+ return isolate->message_handler()->set_pause_on_exit(v);
+}
+
+
+DART_EXPORT bool Dart_IsPausedOnExit() {
+ Isolate* isolate = Isolate::Current();
+ CHECK_ISOLATE(isolate);
+ return isolate->message_handler()->paused_on_exit();
+}
+
+
+DART_EXPORT void Dart_SetPausedOnExit(bool v) {
+ Isolate* isolate = Isolate::Current();
+ CHECK_ISOLATE(isolate);
+ if (isolate->message_handler()->paused_on_exit() != v) {
+ isolate->message_handler()->PausedOnExit(v);
+ if (v) {
+ isolate->message_handler()->NotifyPauseOnExit();
+ }
+ }
+}
+
+
DART_EXPORT void Dart_ExitIsolate() {
Thread* T = Thread::Current();
CHECK_ISOLATE(T->isolate());
@@ -1579,6 +1647,22 @@ DART_EXPORT Dart_Handle Dart_HandleMessage() {
}
+DART_EXPORT Dart_Handle Dart_HandleMessages() {
+ Thread* T = Thread::Current();
+ Isolate* I = T->isolate();
+ CHECK_API_SCOPE(T);
+ CHECK_CALLBACK_STATE(T);
+ API_TIMELINE_BEGIN_END;
+ TransitionNativeToVM transition(T);
+ if (I->message_handler()->HandleNormalMessages() != MessageHandler::kOK) {
+ Dart_Handle error = Api::NewHandle(T, I->object_store()->sticky_error());
+ I->object_store()->clear_sticky_error();
+ return error;
+ }
+ return Api::Success();
+}
+
+
DART_EXPORT bool Dart_HandleServiceMessages() {
Thread* T = Thread::Current();
Isolate* I = T->isolate();

Powered by Google App Engine
This is Rietveld 408576698