diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h index b884b36a689..09d4591d636 100644 --- a/runtime/include/dart_api.h +++ b/runtime/include/dart_api.h @@ -849,7 +849,7 @@ typedef Dart_Handle (*Dart_GetVMServiceAssetsArchive)(void); * The current version of the Dart_InitializeFlags. Should be incremented every * time Dart_InitializeFlags changes in a binary incompatible way. */ -#define DART_INITIALIZE_PARAMS_CURRENT_VERSION (0x00000006) +#define DART_INITIALIZE_PARAMS_CURRENT_VERSION (0x00000007) /** Forward declaration */ struct Dart_CodeObserver; @@ -875,50 +875,6 @@ typedef struct Dart_CodeObserver { Dart_OnNewCodeCallback on_new_code; } Dart_CodeObserver; -typedef struct _Dart_Task* Dart_Task; -typedef enum { - Dart_TaskPriority_Default, -} Dart_TaskPriority; -typedef struct { - /** - * Placeholder. - */ - Dart_TaskPriority priority; - /** - * Time after which the task should run according to the clock of - * Dart_TimelineGetMicros. - */ - int64_t time_point; -} Dart_TaskData; -/** - * Callback provided by the embedder that is used by the VM to eventually run - * various tasks. If no callback is provided, these tasks will run on a - * VM-internal thread pool. This callback allows the embedder to make its own - * choices around the scheduling of these tasks: when they run, how many threads - * are servicing these tasks, the priorities of said threads, etc. - * The callback can be invoked as early as during the Dart_Initialize call. - * - * \param post_task_data - * The data provided to Dart_InitializeParams.post_task_data. - * \param task - * A task that should eventually be passed to Dart_RunTask. - * \param task_data - * Hints about when the task should run. - */ -typedef void (*Dart_PostTaskCallback)(void* post_task_data, - Dart_Task task, - Dart_TaskData task_data); - -/** - * Runs a task given to the Dart_PostTaskCallback. Must not be called - * synchronously in response to any callback from the VM. In particular, must - * not be called synchronously by the implemention of a Dart native function - * or Dart_Post_TaskCallback. - * - * Requires there to be no current isolate or isolate group. - */ -DART_EXPORT void Dart_RunTask(Dart_Task task); - /** * Optional callback provided by the embedder that is used by the VM to * implement registration of kernel blobs for the subsequent Isolate.spawnUri @@ -1027,13 +983,6 @@ typedef struct { */ Dart_CodeObserver* code_observer; - /** - * A task scheduling callback function. See Dart_PostTaskCallback. - */ - Dart_PostTaskCallback post_task; - - void* post_task_data; - /** * Kernel blob registration callback function. See Dart_RegisterKernelBlobCallback. */ diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc index 9042281fc2a..bf4c995ab00 100644 --- a/runtime/vm/dart.cc +++ b/runtime/vm/dart.cc @@ -69,8 +69,6 @@ Dart_FileWriteCallback Dart::file_write_callback_ = NULL; Dart_FileCloseCallback Dart::file_close_callback_ = NULL; Dart_EntropySource Dart::entropy_source_callback_ = NULL; Dart_GCEventCallback Dart::gc_event_callback_ = nullptr; -Dart_PostTaskCallback Dart::post_task_callback_ = nullptr; -void* Dart::post_task_data_ = nullptr; // Structure for managing read-only global handles allocation used for // creating global read-only handles that are pre created and initialized @@ -283,8 +281,6 @@ char* Dart::DartInit(const Dart_InitializeParams* params) { SetFileCallbacks(params->file_open, params->file_read, params->file_write, params->file_close); set_entropy_source_callback(params->entropy_source); - set_post_task_callback(params->post_task); - set_post_task_data(params->post_task_data); OS::Init(); NOT_IN_PRODUCT(CodeObservers::Init()); if (params->code_observer != nullptr) { @@ -802,8 +798,6 @@ char* Dart::Cleanup() { Service::SetEmbedderStreamCallbacks(NULL, NULL); #endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) VirtualMemory::Cleanup(); - post_task_callback_ = nullptr; - post_task_data_ = nullptr; return NULL; } diff --git a/runtime/vm/dart.h b/runtime/vm/dart.h index 9b88af17945..ede6a2f16e9 100644 --- a/runtime/vm/dart.h +++ b/runtime/vm/dart.h @@ -114,14 +114,6 @@ class Dart : public AllStatic { static void set_thread_exit_callback(Dart_ThreadExitCallback cback) { thread_exit_callback_ = cback; } - static Dart_PostTaskCallback post_task_callback() { - return post_task_callback_; - } - static void set_post_task_callback(Dart_PostTaskCallback cback) { - post_task_callback_ = cback; - } - static void* post_task_data() { return post_task_data_; } - static void set_post_task_data(void* data) { post_task_data_ = data; } static void SetFileCallbacks(Dart_FileOpenCallback file_open, Dart_FileReadCallback file_read, Dart_FileWriteCallback file_write, @@ -179,8 +171,6 @@ class Dart : public AllStatic { static Dart_FileCloseCallback file_close_callback_; static Dart_EntropySource entropy_source_callback_; static Dart_GCEventCallback gc_event_callback_; - static Dart_PostTaskCallback post_task_callback_; - static void* post_task_data_; }; } // namespace dart diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc index 400aff2b47a..c38de03364c 100644 --- a/runtime/vm/dart_api_impl.cc +++ b/runtime/vm/dart_api_impl.cc @@ -2047,16 +2047,6 @@ DART_EXPORT bool Dart_RunLoopAsync(bool errors_are_fatal, return true; } -DART_EXPORT void Dart_RunTask(Dart_Task task) { - Thread* T = Thread::Current(); - Isolate* I = T == nullptr ? nullptr : T->isolate(); - CHECK_NO_ISOLATE(I); - API_TIMELINE_BEGIN_END(T); - ThreadPool::Task* task_impl = reinterpret_cast(task); - task_impl->Run(); - delete task_impl; -} - DART_EXPORT Dart_Handle Dart_HandleMessage() { Thread* T = Thread::Current(); Isolate* I = T->isolate(); diff --git a/runtime/vm/thread_pool.cc b/runtime/vm/thread_pool.cc index ac6adfc8808..1cf0b8f055e 100644 --- a/runtime/vm/thread_pool.cc +++ b/runtime/vm/thread_pool.cc @@ -82,22 +82,6 @@ void ThreadPool::Shutdown() { } bool ThreadPool::RunImpl(std::unique_ptr task) { - Dart_PostTaskCallback post_task = Dart::post_task_callback(); - if (post_task != nullptr) { - { - MonitorLocker ml(&pool_monitor_); - if (shutting_down_) { - return false; - } - } - Dart_TaskData data; - data.priority = Dart_TaskPriority_Default; - data.time_point = 0; - post_task(Dart::post_task_data(), - reinterpret_cast(task.release()), data); - return true; - } - Worker* new_worker = nullptr; { MonitorLocker ml(&pool_monitor_);