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

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

Issue 2411153002: Make reloadSources service RPC public (Closed)
Patch Set: turnidge review Created 4 years, 2 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
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/isolate.h" 5 #include "vm/isolate.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/assert.h" 9 #include "platform/assert.h"
10 #include "platform/text_buffer.h" 10 #include "platform/text_buffer.h"
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 spawn_count_monitor_(new Monitor()), 840 spawn_count_monitor_(new Monitor()),
841 spawn_count_(0), 841 spawn_count_(0),
842 #define ISOLATE_METRIC_CONSTRUCTORS(type, variable, name, unit) \ 842 #define ISOLATE_METRIC_CONSTRUCTORS(type, variable, name, unit) \
843 metric_##variable##_(), 843 metric_##variable##_(),
844 ISOLATE_METRIC_LIST(ISOLATE_METRIC_CONSTRUCTORS) 844 ISOLATE_METRIC_LIST(ISOLATE_METRIC_CONSTRUCTORS)
845 #undef ISOLATE_METRIC_CONSTRUCTORS 845 #undef ISOLATE_METRIC_CONSTRUCTORS
846 has_attempted_reload_(false), 846 has_attempted_reload_(false),
847 no_reload_scope_depth_(0), 847 no_reload_scope_depth_(0),
848 reload_every_n_stack_overflow_checks_(FLAG_reload_every), 848 reload_every_n_stack_overflow_checks_(FLAG_reload_every),
849 reload_context_(NULL), 849 reload_context_(NULL),
850 last_reload_timestamp_(OS::GetCurrentTimeMillis()) { 850 last_reload_timestamp_(OS::GetCurrentTimeMillis()),
851 should_pause_post_service_request_(false) {
851 NOT_IN_PRODUCT(FlagsCopyFrom(api_flags)); 852 NOT_IN_PRODUCT(FlagsCopyFrom(api_flags));
852 // TODO(asiva): A Thread is not available here, need to figure out 853 // TODO(asiva): A Thread is not available here, need to figure out
853 // how the vm_tag (kEmbedderTagId) can be set, these tags need to 854 // how the vm_tag (kEmbedderTagId) can be set, these tags need to
854 // move to the OSThread structure. 855 // move to the OSThread structure.
855 set_user_tag(UserTags::kDefaultUserTag); 856 set_user_tag(UserTags::kDefaultUserTag);
856 } 857 }
857 858
858 #undef REUSABLE_HANDLE_SCOPE_INIT 859 #undef REUSABLE_HANDLE_SCOPE_INIT
859 #undef REUSABLE_HANDLE_INITIALIZERS 860 #undef REUSABLE_HANDLE_INITIALIZERS
860 861
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 } 1042 }
1042 } 1043 }
1043 1044
1044 1045
1045 void Isolate::set_debugger_name(const char* name) { 1046 void Isolate::set_debugger_name(const char* name) {
1046 free(debugger_name_); 1047 free(debugger_name_);
1047 debugger_name_ = strdup(name); 1048 debugger_name_ = strdup(name);
1048 } 1049 }
1049 1050
1050 1051
1052 bool Isolate::IsPaused() const {
1053 return (debugger_ != NULL) && (debugger_->PauseEvent() != NULL);
1054 }
1055
1056
1057 void Isolate::PausePostRequest() {
1058 if (debugger_ == NULL) {
1059 return;
1060 }
1061 ASSERT(!IsPaused());
1062 const Error& error = Error::Handle(debugger_->PausePostRequest());
1063 if (!error.IsNull()) {
1064 Exceptions::PropagateError(error);
1065 }
1066 }
1067
1068
1051 void Isolate::BuildName(const char* name_prefix) { 1069 void Isolate::BuildName(const char* name_prefix) {
1052 ASSERT(name_ == NULL); 1070 ASSERT(name_ == NULL);
1053 if (name_prefix == NULL) { 1071 if (name_prefix == NULL) {
1054 name_prefix = "isolate"; 1072 name_prefix = "isolate";
1055 } 1073 }
1056 set_debugger_name(name_prefix); 1074 set_debugger_name(name_prefix);
1057 if (ServiceIsolate::NameEquals(name_prefix)) { 1075 if (ServiceIsolate::NameEquals(name_prefix)) {
1058 name_ = strdup(name_prefix); 1076 name_ = strdup(name_prefix);
1059 return; 1077 return;
1060 } 1078 }
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 if (!is_runnable()) { 2013 if (!is_runnable()) {
1996 // Isolate is not yet runnable. 2014 // Isolate is not yet runnable.
1997 ASSERT((debugger() == NULL) || (debugger()->PauseEvent() == NULL)); 2015 ASSERT((debugger() == NULL) || (debugger()->PauseEvent() == NULL));
1998 ServiceEvent pause_event(this, ServiceEvent::kNone); 2016 ServiceEvent pause_event(this, ServiceEvent::kNone);
1999 jsobj.AddProperty("pauseEvent", &pause_event); 2017 jsobj.AddProperty("pauseEvent", &pause_event);
2000 } else if (message_handler()->is_paused_on_start() || 2018 } else if (message_handler()->is_paused_on_start() ||
2001 message_handler()->should_pause_on_start()) { 2019 message_handler()->should_pause_on_start()) {
2002 ASSERT((debugger() == NULL) || (debugger()->PauseEvent() == NULL)); 2020 ASSERT((debugger() == NULL) || (debugger()->PauseEvent() == NULL));
2003 ServiceEvent pause_event(this, ServiceEvent::kPauseStart); 2021 ServiceEvent pause_event(this, ServiceEvent::kPauseStart);
2004 jsobj.AddProperty("pauseEvent", &pause_event); 2022 jsobj.AddProperty("pauseEvent", &pause_event);
2005 } else if (message_handler()->is_paused_on_exit()) { 2023 } else if (message_handler()->is_paused_on_exit() &&
2006 ASSERT((debugger() == NULL) || (debugger()->PauseEvent() == NULL)); 2024 ((debugger() == NULL) || (debugger()->PauseEvent() == NULL))) {
2007 ServiceEvent pause_event(this, ServiceEvent::kPauseExit); 2025 ServiceEvent pause_event(this, ServiceEvent::kPauseExit);
2008 jsobj.AddProperty("pauseEvent", &pause_event); 2026 jsobj.AddProperty("pauseEvent", &pause_event);
2009 } else if ((debugger() != NULL) && 2027 } else if ((debugger() != NULL) &&
2010 (debugger()->PauseEvent() != NULL) && 2028 (debugger()->PauseEvent() != NULL) &&
2011 !resume_request_) { 2029 !resume_request_) {
2012 jsobj.AddProperty("pauseEvent", debugger()->PauseEvent()); 2030 jsobj.AddProperty("pauseEvent", debugger()->PauseEvent());
2013 } else { 2031 } else {
2014 ServiceEvent pause_event(this, ServiceEvent::kResume); 2032 ServiceEvent pause_event(this, ServiceEvent::kResume);
2015 2033
2016 if (debugger() != NULL) { 2034 if (debugger() != NULL) {
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
2946 void IsolateSpawnState::DecrementSpawnCount() { 2964 void IsolateSpawnState::DecrementSpawnCount() {
2947 ASSERT(spawn_count_monitor_ != NULL); 2965 ASSERT(spawn_count_monitor_ != NULL);
2948 ASSERT(spawn_count_ != NULL); 2966 ASSERT(spawn_count_ != NULL);
2949 MonitorLocker ml(spawn_count_monitor_); 2967 MonitorLocker ml(spawn_count_monitor_);
2950 ASSERT(*spawn_count_ > 0); 2968 ASSERT(*spawn_count_ > 0);
2951 *spawn_count_ = *spawn_count_ - 1; 2969 *spawn_count_ = *spawn_count_ - 1;
2952 ml.Notify(); 2970 ml.Notify();
2953 } 2971 }
2954 2972
2955 } // namespace dart 2973 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698