2015-02-12 19:10:55 +00:00
|
|
|
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
2016-10-26 07:26:03 +00:00
|
|
|
#ifndef RUNTIME_VM_SERVICE_ISOLATE_H_
|
|
|
|
#define RUNTIME_VM_SERVICE_ISOLATE_H_
|
2015-02-12 19:10:55 +00:00
|
|
|
|
|
|
|
#include "include/dart_api.h"
|
|
|
|
|
|
|
|
#include "vm/allocation.h"
|
|
|
|
#include "vm/os_thread.h"
|
|
|
|
|
|
|
|
namespace dart {
|
|
|
|
|
2016-06-10 19:33:50 +00:00
|
|
|
class ObjectPointerVisitor;
|
|
|
|
|
2015-02-12 19:10:55 +00:00
|
|
|
class ServiceIsolate : public AllStatic {
|
|
|
|
public:
|
|
|
|
static const char* kName;
|
|
|
|
static bool NameEquals(const char* name);
|
|
|
|
|
|
|
|
static bool Exists();
|
|
|
|
static bool IsRunning();
|
2016-05-17 19:19:06 +00:00
|
|
|
static bool IsServiceIsolate(const Isolate* isolate);
|
|
|
|
static bool IsServiceIsolateDescendant(const Isolate* isolate);
|
2015-02-12 19:10:55 +00:00
|
|
|
static Dart_Port Port();
|
|
|
|
|
|
|
|
static Dart_Port WaitForLoadPort();
|
|
|
|
static Dart_Port LoadPort();
|
|
|
|
|
|
|
|
static void Run();
|
|
|
|
static bool SendIsolateStartupMessage();
|
|
|
|
static bool SendIsolateShutdownMessage();
|
2015-03-25 15:50:19 +00:00
|
|
|
static void SendServiceExitMessage();
|
|
|
|
static void Shutdown();
|
2015-02-12 19:10:55 +00:00
|
|
|
|
2015-10-06 16:16:39 +00:00
|
|
|
static void BootVmServiceLibrary();
|
|
|
|
|
2016-01-29 15:43:21 +00:00
|
|
|
static void SetServerAddress(const char* address);
|
|
|
|
|
|
|
|
// Returns the server's web address or NULL if none is running.
|
|
|
|
static const char* server_address() {
|
|
|
|
return server_address_;
|
|
|
|
}
|
|
|
|
|
2016-06-10 19:33:50 +00:00
|
|
|
static void VisitObjectPointers(ObjectPointerVisitor* visitor);
|
|
|
|
|
2015-09-15 19:49:52 +00:00
|
|
|
private:
|
|
|
|
static void KillServiceIsolate();
|
|
|
|
|
2015-02-12 19:10:55 +00:00
|
|
|
protected:
|
|
|
|
static void SetServicePort(Dart_Port port);
|
|
|
|
static void SetServiceIsolate(Isolate* isolate);
|
|
|
|
static void SetLoadPort(Dart_Port port);
|
2015-03-25 15:50:19 +00:00
|
|
|
static void ConstructExitMessageAndCache(Isolate* isolate);
|
|
|
|
static void FinishedExiting();
|
2015-02-12 19:10:55 +00:00
|
|
|
static void FinishedInitializing();
|
2015-10-06 14:58:14 +00:00
|
|
|
static void MaybeMakeServiceIsolate(Isolate* isolate);
|
2015-02-12 19:10:55 +00:00
|
|
|
static Dart_IsolateCreateCallback create_callback() {
|
|
|
|
return create_callback_;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Dart_IsolateCreateCallback create_callback_;
|
2015-03-25 15:50:19 +00:00
|
|
|
static uint8_t* exit_message_;
|
|
|
|
static intptr_t exit_message_length_;
|
2015-02-12 19:10:55 +00:00
|
|
|
static Monitor* monitor_;
|
|
|
|
static bool initializing_;
|
2015-03-25 15:50:19 +00:00
|
|
|
static bool shutting_down_;
|
2015-02-12 19:10:55 +00:00
|
|
|
static Isolate* isolate_;
|
|
|
|
static Dart_Port port_;
|
|
|
|
static Dart_Port load_port_;
|
2015-04-01 20:23:42 +00:00
|
|
|
static Dart_Port origin_;
|
2016-01-29 15:43:21 +00:00
|
|
|
static char* server_address_;
|
2015-02-12 19:10:55 +00:00
|
|
|
|
|
|
|
friend class Dart;
|
|
|
|
friend class RunServiceTask;
|
|
|
|
friend class ServiceIsolateNatives;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dart
|
|
|
|
|
2016-10-26 07:26:03 +00:00
|
|
|
#endif // RUNTIME_VM_SERVICE_ISOLATE_H_
|