| Index: runtime/vm/service_isolate.cc
|
| diff --git a/runtime/vm/service_isolate.cc b/runtime/vm/service_isolate.cc
|
| index 0cb3cd25c114fdf34ea81687e020dedda09950fb..6ceeddfcd7bac1b462f6acb944d7fdb28e95cd94 100644
|
| --- a/runtime/vm/service_isolate.cc
|
| +++ b/runtime/vm/service_isolate.cc
|
| @@ -11,8 +11,8 @@
|
| #include "vm/lockers.h"
|
| #include "vm/message.h"
|
| #include "vm/message_handler.h"
|
| -#include "vm/native_entry.h"
|
| #include "vm/native_arguments.h"
|
| +#include "vm/native_entry.h"
|
| #include "vm/object.h"
|
| #include "vm/object_store.h"
|
| #include "vm/port.h"
|
| @@ -25,7 +25,6 @@ namespace dart {
|
|
|
| #define Z (T->zone())
|
|
|
| -
|
| DEFINE_FLAG(bool, trace_service, false, "Trace VM service requests.");
|
| DEFINE_FLAG(bool,
|
| trace_service_pause_events,
|
| @@ -47,7 +46,6 @@ static void malloc_deallocator(uint8_t* ptr) {
|
| free(reinterpret_cast<void*>(ptr));
|
| }
|
|
|
| -
|
| // These must be kept in sync with service/constants.dart
|
| #define VM_SERVICE_ISOLATE_EXIT_MESSAGE_ID 0
|
| #define VM_SERVICE_ISOLATE_STARTUP_MESSAGE_ID 1
|
| @@ -71,7 +69,6 @@ static RawArray* MakeServiceControlMessage(Dart_Port port_id,
|
| return list.raw();
|
| }
|
|
|
| -
|
| static RawArray* MakeServerControlMessage(const SendPort& sp,
|
| intptr_t code,
|
| bool enable = false) {
|
| @@ -83,7 +80,6 @@ static RawArray* MakeServerControlMessage(const SendPort& sp,
|
| return list.raw();
|
| }
|
|
|
| -
|
| static RawArray* MakeServiceExitMessage() {
|
| const Array& list = Array::Handle(Array::New(1));
|
| ASSERT(!list.IsNull());
|
| @@ -93,7 +89,6 @@ static RawArray* MakeServiceExitMessage() {
|
| return list.raw();
|
| }
|
|
|
| -
|
| const char* ServiceIsolate::kName = "vm-service";
|
| Isolate* ServiceIsolate::isolate_ = NULL;
|
| Dart_Port ServiceIsolate::port_ = ILLEGAL_PORT;
|
| @@ -118,7 +113,6 @@ void ServiceIsolate::RequestServerInfo(const SendPort& sp) {
|
| PortMap::PostMessage(new Message(port_, data, len, Message::kNormalPriority));
|
| }
|
|
|
| -
|
| void ServiceIsolate::ControlWebServer(const SendPort& sp, bool enable) {
|
| const Array& message = Array::Handle(MakeServerControlMessage(
|
| sp, VM_SERVICE_WEB_SERVER_CONTROL_MESSAGE_ID, enable));
|
| @@ -130,7 +124,6 @@ void ServiceIsolate::ControlWebServer(const SendPort& sp, bool enable) {
|
| PortMap::PostMessage(new Message(port_, data, len, Message::kNormalPriority));
|
| }
|
|
|
| -
|
| void ServiceIsolate::SetServerAddress(const char* address) {
|
| if (server_address_ != NULL) {
|
| free(server_address_);
|
| @@ -142,43 +135,36 @@ void ServiceIsolate::SetServerAddress(const char* address) {
|
| server_address_ = strdup(address);
|
| }
|
|
|
| -
|
| bool ServiceIsolate::NameEquals(const char* name) {
|
| ASSERT(name != NULL);
|
| return strcmp(name, kName) == 0;
|
| }
|
|
|
| -
|
| bool ServiceIsolate::Exists() {
|
| MonitorLocker ml(monitor_);
|
| return isolate_ != NULL;
|
| }
|
|
|
| -
|
| bool ServiceIsolate::IsRunning() {
|
| MonitorLocker ml(monitor_);
|
| return (port_ != ILLEGAL_PORT) && (isolate_ != NULL);
|
| }
|
|
|
| -
|
| bool ServiceIsolate::IsServiceIsolate(const Isolate* isolate) {
|
| MonitorLocker ml(monitor_);
|
| return isolate == isolate_;
|
| }
|
|
|
| -
|
| bool ServiceIsolate::IsServiceIsolateDescendant(const Isolate* isolate) {
|
| MonitorLocker ml(monitor_);
|
| return isolate->origin_id() == origin_;
|
| }
|
|
|
| -
|
| Dart_Port ServiceIsolate::Port() {
|
| MonitorLocker ml(monitor_);
|
| return port_;
|
| }
|
|
|
| -
|
| Dart_Port ServiceIsolate::WaitForLoadPort() {
|
| MonitorLocker ml(monitor_);
|
| while (initializing_ && (load_port_ == ILLEGAL_PORT)) {
|
| @@ -187,13 +173,11 @@ Dart_Port ServiceIsolate::WaitForLoadPort() {
|
| return load_port_;
|
| }
|
|
|
| -
|
| Dart_Port ServiceIsolate::LoadPort() {
|
| MonitorLocker ml(monitor_);
|
| return load_port_;
|
| }
|
|
|
| -
|
| bool ServiceIsolate::SendIsolateStartupMessage() {
|
| if (!IsRunning()) {
|
| return false;
|
| @@ -222,7 +206,6 @@ bool ServiceIsolate::SendIsolateStartupMessage() {
|
| new Message(port_, data, len, Message::kNormalPriority));
|
| }
|
|
|
| -
|
| bool ServiceIsolate::SendIsolateShutdownMessage() {
|
| if (!IsRunning()) {
|
| return false;
|
| @@ -251,7 +234,6 @@ bool ServiceIsolate::SendIsolateShutdownMessage() {
|
| new Message(port_, data, len, Message::kNormalPriority));
|
| }
|
|
|
| -
|
| void ServiceIsolate::SendServiceExitMessage() {
|
| if (!IsRunning()) {
|
| return;
|
| @@ -266,13 +248,11 @@ void ServiceIsolate::SendServiceExitMessage() {
|
| Message::kNormalPriority));
|
| }
|
|
|
| -
|
| void ServiceIsolate::SetServicePort(Dart_Port port) {
|
| MonitorLocker ml(monitor_);
|
| port_ = port;
|
| }
|
|
|
| -
|
| void ServiceIsolate::SetServiceIsolate(Isolate* isolate) {
|
| MonitorLocker ml(monitor_);
|
| isolate_ = isolate;
|
| @@ -287,7 +267,6 @@ void ServiceIsolate::SetLoadPort(Dart_Port port) {
|
| load_port_ = port;
|
| }
|
|
|
| -
|
| void ServiceIsolate::MaybeMakeServiceIsolate(Isolate* I) {
|
| Thread* T = Thread::Current();
|
| ASSERT(I == T->isolate());
|
| @@ -304,7 +283,6 @@ void ServiceIsolate::MaybeMakeServiceIsolate(Isolate* I) {
|
| SetServiceIsolate(I);
|
| }
|
|
|
| -
|
| void ServiceIsolate::ConstructExitMessageAndCache(Isolate* I) {
|
| // Construct and cache exit message here so we can send it without needing an
|
| // isolate.
|
| @@ -325,21 +303,18 @@ void ServiceIsolate::ConstructExitMessageAndCache(Isolate* I) {
|
| ASSERT(exit_message_length_ != 0);
|
| }
|
|
|
| -
|
| void ServiceIsolate::FinishedExiting() {
|
| MonitorLocker ml(monitor_);
|
| shutting_down_ = false;
|
| ml.NotifyAll();
|
| }
|
|
|
| -
|
| void ServiceIsolate::FinishedInitializing() {
|
| MonitorLocker ml(monitor_);
|
| initializing_ = false;
|
| ml.NotifyAll();
|
| }
|
|
|
| -
|
| class RunServiceTask : public ThreadPool::Task {
|
| public:
|
| virtual void Run() {
|
| @@ -481,7 +456,6 @@ class RunServiceTask : public ThreadPool::Task {
|
| }
|
| };
|
|
|
| -
|
| void ServiceIsolate::Run() {
|
| // Grab the isolate create callback here to avoid race conditions with tests
|
| // that change this after Dart_Initialize returns.
|
| @@ -489,7 +463,6 @@ void ServiceIsolate::Run() {
|
| Dart::thread_pool()->Run(new RunServiceTask());
|
| }
|
|
|
| -
|
| void ServiceIsolate::KillServiceIsolate() {
|
| {
|
| MonitorLocker ml(monitor_);
|
| @@ -504,7 +477,6 @@ void ServiceIsolate::KillServiceIsolate() {
|
| }
|
| }
|
|
|
| -
|
| void ServiceIsolate::Shutdown() {
|
| if (IsRunning()) {
|
| {
|
| @@ -533,7 +505,6 @@ void ServiceIsolate::Shutdown() {
|
| }
|
| }
|
|
|
| -
|
| void ServiceIsolate::BootVmServiceLibrary() {
|
| Thread* thread = Thread::Current();
|
| const Library& vmservice_library =
|
| @@ -557,7 +528,6 @@ void ServiceIsolate::BootVmServiceLibrary() {
|
| ServiceIsolate::SetServicePort(port);
|
| }
|
|
|
| -
|
| void ServiceIsolate::VisitObjectPointers(ObjectPointerVisitor* visitor) {}
|
|
|
| } // namespace dart
|
|
|