[vm/cleanup] Remove unused start_callback, enable_vm_service, paused_for_messages.
TEST=ci Change-Id: I101a355de9b0c2b36c8977c3af962a3e283a72d7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493862 Commit-Queue: Alexander Aprelev <aam@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
committed by
Commit Queue
parent
16854dc720
commit
8999b65531
@@ -273,7 +273,6 @@ bool Options::ParseArguments(int argc,
|
||||
|
||||
// These strings must match the enum VerbosityLevel in main_options.h.
|
||||
VerbosityLevel Options::verbosity_ = kAll;
|
||||
bool Options::enable_vm_service_ = false;
|
||||
bool Options::enable_dds_ = true;
|
||||
|
||||
void Options::PrintVersion() {
|
||||
@@ -454,7 +453,6 @@ bool Options::ProcessEnableVmServiceOption(const char* arg,
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
dfe()->set_use_incremental_compiler(true);
|
||||
#endif // !defined(DART_PRECOMPILED_RUNTIME)
|
||||
enable_vm_service_ = true;
|
||||
return true;
|
||||
#else
|
||||
// VM service not available in product mode.
|
||||
@@ -487,7 +485,6 @@ bool Options::ProcessObserveOption(const char* arg,
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
dfe()->set_use_incremental_compiler(true);
|
||||
#endif // !defined(DART_PRECOMPILED_RUNTIME)
|
||||
enable_vm_service_ = true;
|
||||
return true;
|
||||
#else
|
||||
// VM service not available in product mode.
|
||||
|
||||
@@ -150,7 +150,6 @@ class Options {
|
||||
|
||||
static dart::SimpleHashMap* environment() { return environment_; }
|
||||
|
||||
static bool enable_vm_service() { return enable_vm_service_; }
|
||||
#if !defined(PRODUCT)
|
||||
static const char* vm_service_server_ip() { return vm_service_server_ip_; }
|
||||
static int vm_service_server_port() { return vm_service_server_port_; }
|
||||
@@ -230,7 +229,6 @@ class Options {
|
||||
}
|
||||
|
||||
// VM Service argument processing.
|
||||
static bool enable_vm_service_;
|
||||
#if !defined(PRODUCT)
|
||||
static const char* vm_service_server_ip_;
|
||||
static int vm_service_server_port_;
|
||||
|
||||
@@ -1985,9 +1985,8 @@ DART_EXPORT Dart_Handle Dart_RunLoop() {
|
||||
RunLoopData data;
|
||||
data.monitor = &monitor;
|
||||
data.done = false;
|
||||
result =
|
||||
I->message_handler()->Run(I->group()->thread_pool(), nullptr,
|
||||
RunLoopDone, reinterpret_cast<uword>(&data));
|
||||
result = I->message_handler()->Run(I->group()->thread_pool(), RunLoopDone,
|
||||
reinterpret_cast<uword>(&data));
|
||||
if (result) {
|
||||
while (!data.done) {
|
||||
ml.Wait();
|
||||
|
||||
@@ -2457,7 +2457,7 @@ void Isolate::SetStickyError(ErrorPtr sticky_error) {
|
||||
}
|
||||
|
||||
void Isolate::Run() {
|
||||
message_handler()->Run(group()->thread_pool(), nullptr, ShutdownIsolate,
|
||||
message_handler()->Run(group()->thread_pool(), ShutdownIsolate,
|
||||
reinterpret_cast<uword>(this));
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ class RunKernelTask : public ThreadPool::Task {
|
||||
// isolate_ was set as side effect of create callback.
|
||||
ASSERT(isolate->is_kernel_isolate());
|
||||
|
||||
isolate->message_handler()->Run(isolate->group()->thread_pool(), nullptr,
|
||||
isolate->message_handler()->Run(isolate->group()->thread_pool(),
|
||||
ShutdownIsolate,
|
||||
reinterpret_cast<uword>(isolate));
|
||||
}
|
||||
|
||||
@@ -56,7 +56,6 @@ MessageHandler::MessageHandler()
|
||||
: queue_(new MessageQueue()),
|
||||
oob_queue_(new MessageQueue()),
|
||||
oob_message_handling_allowed_(true),
|
||||
paused_for_messages_(false),
|
||||
paused_(0),
|
||||
#if !defined(PRODUCT)
|
||||
should_pause_on_start_(false),
|
||||
@@ -68,7 +67,6 @@ MessageHandler::MessageHandler()
|
||||
#endif
|
||||
task_running_(false),
|
||||
pool_(nullptr),
|
||||
start_callback_(nullptr),
|
||||
end_callback_(nullptr),
|
||||
callback_data_(0) {
|
||||
ASSERT(queue_ != nullptr);
|
||||
@@ -92,7 +90,6 @@ void MessageHandler::MessageNotify(Message::Priority priority) {
|
||||
}
|
||||
|
||||
bool MessageHandler::Run(ThreadPool* pool,
|
||||
StartCallback start_callback,
|
||||
EndCallback end_callback,
|
||||
CallbackData data) {
|
||||
MonitorLocker ml(&monitor_);
|
||||
@@ -104,14 +101,12 @@ bool MessageHandler::Run(ThreadPool* pool,
|
||||
}
|
||||
ASSERT(pool_ == nullptr);
|
||||
pool_ = pool;
|
||||
start_callback_ = start_callback;
|
||||
end_callback_ = end_callback;
|
||||
callback_data_ = data;
|
||||
task_running_ = true;
|
||||
bool result = pool_->Run<MessageHandlerTask>(this);
|
||||
if (!result) {
|
||||
pool_ = nullptr;
|
||||
start_callback_ = nullptr;
|
||||
end_callback_ = nullptr;
|
||||
callback_data_ = 0;
|
||||
task_running_ = false;
|
||||
@@ -152,9 +147,6 @@ void MessageHandler::PostMessage(std::unique_ptr<Message> message,
|
||||
} else {
|
||||
queue_->Enqueue(std::move(message), before_events);
|
||||
}
|
||||
if (paused_for_messages_) {
|
||||
ml.Notify();
|
||||
}
|
||||
|
||||
if (pool_ != nullptr && !task_running_) {
|
||||
task_running_ = true;
|
||||
@@ -391,19 +383,6 @@ void MessageHandler::TaskCallback() {
|
||||
#endif // !defined(PRODUCT)
|
||||
|
||||
if (status == kOK) {
|
||||
if (start_callback_ != nullptr) {
|
||||
// Initialize the message handler by running its start function,
|
||||
// if we have one. For an isolate, this will run the isolate's
|
||||
// main() function.
|
||||
//
|
||||
// Release the monitor_ temporarily while we call the start callback.
|
||||
ml.Exit();
|
||||
status = start_callback_(callback_data_);
|
||||
ASSERT(Isolate::Current() == nullptr);
|
||||
start_callback_ = nullptr;
|
||||
ml.Enter();
|
||||
}
|
||||
|
||||
// Handle any pending messages for this message handler.
|
||||
if (status != kShutdown) {
|
||||
status = HandleMessages(&ml, (status == kOK), true);
|
||||
@@ -411,7 +390,7 @@ void MessageHandler::TaskCallback() {
|
||||
}
|
||||
|
||||
// The isolate exits when it encounters an error or when it no
|
||||
// longer has live ports.
|
||||
// longer has live ports or ffi native callbacks keeping it alive.
|
||||
if (status != kOK || !KeepAliveLocked()) {
|
||||
#if !defined(PRODUCT)
|
||||
if (ShouldPauseOnExit(status)) {
|
||||
|
||||
@@ -33,13 +33,10 @@ class MessageHandler : public PortHandler {
|
||||
virtual ~MessageHandler();
|
||||
|
||||
typedef uword CallbackData;
|
||||
typedef MessageStatus (*StartCallback)(CallbackData data);
|
||||
typedef void (*EndCallback)(CallbackData data);
|
||||
|
||||
// Runs this message handler on the thread pool.
|
||||
//
|
||||
// Before processing messages, the optional StartFunction is run.
|
||||
//
|
||||
// A message handler will run until it terminates either normally or
|
||||
// abnormally. Normal termination occurs when the message handler
|
||||
// no longer has any live ports. Abnormal termination occurs when
|
||||
@@ -48,10 +45,7 @@ class MessageHandler : public PortHandler {
|
||||
|
||||
// Returns false if the handler terminated abnormally, otherwise it
|
||||
// returns true.
|
||||
bool Run(ThreadPool* pool,
|
||||
StartCallback start_callback,
|
||||
EndCallback end_callback,
|
||||
CallbackData data);
|
||||
bool Run(ThreadPool* pool, EndCallback end_callback, CallbackData data);
|
||||
|
||||
// Handles the next message for this message handler. Should only
|
||||
// be used when not running the handler on the thread pool (via Run
|
||||
@@ -232,7 +226,6 @@ class MessageHandler : public PortHandler {
|
||||
// This flag is not thread safe and can only reliably be accessed on a single
|
||||
// thread.
|
||||
bool oob_message_handling_allowed_;
|
||||
bool paused_for_messages_;
|
||||
|
||||
// Only accessed by [PortMap], protected by [PortMap]s lock. See ports()
|
||||
// getter.
|
||||
@@ -251,7 +244,6 @@ class MessageHandler : public PortHandler {
|
||||
#endif
|
||||
bool task_running_;
|
||||
ThreadPool* pool_;
|
||||
StartCallback start_callback_;
|
||||
EndCallback end_callback_;
|
||||
CallbackData callback_data_;
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ class TestMessageHandler : public MessageHandler {
|
||||
port_buffer_size_(0),
|
||||
notify_count_(0),
|
||||
message_count_(0),
|
||||
start_called_(false),
|
||||
end_called_(false),
|
||||
results_(nullptr),
|
||||
monitor_() {}
|
||||
@@ -68,11 +67,6 @@ class TestMessageHandler : public MessageHandler {
|
||||
return status;
|
||||
}
|
||||
|
||||
MessageStatus Start() {
|
||||
start_called_ = true;
|
||||
return kOK;
|
||||
}
|
||||
|
||||
void End() {
|
||||
MonitorLocker ml(&monitor_);
|
||||
end_called_ = true;
|
||||
@@ -83,7 +77,6 @@ class TestMessageHandler : public MessageHandler {
|
||||
Dart_Port* port_buffer() const { return port_buffer_; }
|
||||
int notify_count() const { return notify_count_; }
|
||||
int message_count() const { return message_count_; }
|
||||
bool start_called() const { return start_called_; }
|
||||
bool end_called() const { return end_called_; }
|
||||
|
||||
void set_results(MessageStatus* results) { results_ = results; }
|
||||
@@ -112,7 +105,6 @@ class TestMessageHandler : public MessageHandler {
|
||||
int port_buffer_size_;
|
||||
int notify_count_;
|
||||
int message_count_;
|
||||
bool start_called_;
|
||||
bool end_called_;
|
||||
MessageStatus* results_;
|
||||
Monitor monitor_;
|
||||
@@ -120,10 +112,6 @@ class TestMessageHandler : public MessageHandler {
|
||||
DISALLOW_COPY_AND_ASSIGN(TestMessageHandler);
|
||||
};
|
||||
|
||||
MessageHandler::MessageStatus TestStartFunction(uword data) {
|
||||
return (reinterpret_cast<TestMessageHandler*>(data))->Start();
|
||||
}
|
||||
|
||||
void TestEndFunction(uword data) {
|
||||
return (reinterpret_cast<TestMessageHandler*>(data))->End();
|
||||
}
|
||||
@@ -349,8 +337,7 @@ VM_UNIT_TEST_CASE(MessageHandler_Run) {
|
||||
ThreadPool pool;
|
||||
MessageHandlerTestPeer handler_peer(&handler);
|
||||
|
||||
handler.Run(&pool, TestStartFunction, TestEndFunction,
|
||||
reinterpret_cast<uword>(&handler));
|
||||
handler.Run(&pool, TestEndFunction, reinterpret_cast<uword>(&handler));
|
||||
|
||||
EXPECT(!PortMap::HasPorts(&handler));
|
||||
Dart_Port port = PortMap::CreatePort(&handler);
|
||||
@@ -365,7 +352,6 @@ VM_UNIT_TEST_CASE(MessageHandler_Run) {
|
||||
ml.Wait();
|
||||
}
|
||||
EXPECT_EQ(1, handler.message_count());
|
||||
EXPECT(handler.start_called());
|
||||
EXPECT(!handler.end_called());
|
||||
Dart_Port* handler_ports = handler.port_buffer();
|
||||
EXPECT_EQ(port, handler_ports[0]);
|
||||
@@ -391,7 +377,6 @@ VM_UNIT_TEST_CASE(MessageHandler_Run) {
|
||||
}
|
||||
Dart_Port* handler_ports = handler.port_buffer();
|
||||
EXPECT_EQ(11, handler.message_count());
|
||||
EXPECT(handler.start_called());
|
||||
EXPECT(!handler.end_called());
|
||||
EXPECT_EQ(port, handler_ports[0]);
|
||||
for (int i = 1; i < 11; i++) {
|
||||
|
||||
@@ -401,7 +401,7 @@ class RunServiceTask : public ThreadPool::Task {
|
||||
}
|
||||
|
||||
isolate->message_handler()->Run(
|
||||
isolate->group()->thread_pool(), nullptr,
|
||||
isolate->group()->thread_pool(),
|
||||
[](uword parameter) {
|
||||
ShutdownIsolate(reinterpret_cast<Dart_Isolate>(parameter));
|
||||
ServiceIsolate::FinishedExiting();
|
||||
|
||||
Reference in New Issue
Block a user