// Copyright 2018 the Deno authors. All rights reserved. MIT license. #ifndef INTERNAL_H_ #define INTERNAL_H_ #include #include #include "deno.h" #include "third_party/v8/include/v8.h" extern "C" { // deno_s = Wrapped Isolate. struct deno_s { v8::Isolate* isolate; const v8::FunctionCallbackInfo* currentArgs; std::string last_exception; v8::Persistent recv; v8::Persistent global_error_handler; v8::Persistent promise_reject_handler; v8::Persistent promise_error_examiner; v8::Persistent global_import_buf; void* global_import_buf_ptr; int32_t pending_promise_events; v8::Persistent context; std::map> async_data_map; deno_recv_cb cb; int32_t next_req_id; void* user_data; }; } namespace deno { struct InternalFieldData { uint32_t data; }; void Print(const v8::FunctionCallbackInfo& args); void Recv(const v8::FunctionCallbackInfo& args); void Send(const v8::FunctionCallbackInfo& args); void SetGlobalErrorHandler(const v8::FunctionCallbackInfo& args); void SetPromiseRejectHandler(const v8::FunctionCallbackInfo& args); void SetPromiseErrorExaminer(const v8::FunctionCallbackInfo& args); static intptr_t external_references[] = { reinterpret_cast(Print), reinterpret_cast(Recv), reinterpret_cast(Send), reinterpret_cast(SetGlobalErrorHandler), reinterpret_cast(SetPromiseRejectHandler), reinterpret_cast(SetPromiseErrorExaminer), 0}; Deno* NewFromSnapshot(void* user_data, deno_recv_cb cb); void InitializeContext(v8::Isolate* isolate, v8::Local context, const char* js_filename, const std::string& js_source, const std::string* source_map); void AddIsolate(Deno* d, v8::Isolate* isolate); } // namespace deno #endif // INTERNAL_H_