@@ -54,18 +54,34 @@ class WasmBase : public std::enable_shared_from_this<WasmBase> {
5454 WasmBase (const std::shared_ptr<WasmHandleBase> &base_wasm_handle, const WasmVmFactory &factory);
5555 virtual ~WasmBase ();
5656
57+ #ifdef PROXY_WASM_CPP_HOST_MORE_VIRTUAL_METHODS
58+ virtual bool load (const std::string &code, bool allow_precompiled = false );
59+ virtual bool initialize ();
60+ virtual void startVm (ContextBase *root_context);
61+ virtual bool configure (ContextBase *root_context, std::shared_ptr<PluginBase> plugin);
62+ #else
5763 bool load (const std::string &code, bool allow_precompiled = false );
5864 bool initialize ();
5965 void startVm (ContextBase *root_context);
6066 bool configure (ContextBase *root_context, std::shared_ptr<PluginBase> plugin);
67+ #endif
6168 // Returns the root ContextBase or nullptr if onStart returns false.
69+ #ifdef PROXY_WASM_CPP_HOST_MORE_VIRTUAL_METHODS
70+ virtual ContextBase *start (const std::shared_ptr<PluginBase> &plugin);
71+ #else
6272 ContextBase *start (const std::shared_ptr<PluginBase> &plugin);
73+ #endif
6374
6475 std::string_view vm_id () const { return vm_id_; }
6576 std::string_view vm_key () const { return vm_key_; }
6677 WasmVm *wasm_vm () const { return wasm_vm_.get (); }
78+ #ifdef PROXY_WASM_CPP_HOST_MORE_VIRTUAL_METHODS
79+ virtual ContextBase *vm_context () const { return vm_context_.get (); }
80+ virtual ContextBase *getRootContext (const std::shared_ptr<PluginBase> &plugin, bool allow_closed);
81+ #else
6782 ContextBase *vm_context () const { return vm_context_.get (); }
6883 ContextBase *getRootContext (const std::shared_ptr<PluginBase> &plugin, bool allow_closed);
84+ #endif
6985 ContextBase *getContext (uint32_t id) {
7086 auto it = contexts_.find (id);
7187 if (it != contexts_.end ())
@@ -321,14 +337,23 @@ using WasmHandleCloneFactory =
321337class WasmHandleBase : public std ::enable_shared_from_this<WasmHandleBase> {
322338public:
323339 explicit WasmHandleBase (std::shared_ptr<WasmBase> wasm_base) : wasm_base_(wasm_base) {}
340+ #ifdef PROXY_WASM_CPP_HOST_MORE_VIRTUAL_METHODS
341+ virtual ~WasmHandleBase () {
342+ #else
324343 ~WasmHandleBase () {
344+ #endif
325345 if (wasm_base_) {
326346 wasm_base_->startShutdown ();
327347 }
328348 }
329349
350+ #ifdef PROXY_WASM_CPP_HOST_MORE_VIRTUAL_METHODS
351+ virtual bool canary (const std::shared_ptr<PluginBase> &plugin,
352+ const WasmHandleCloneFactory &clone_factory);
353+ #else
330354 bool canary (const std::shared_ptr<PluginBase> &plugin,
331355 const WasmHandleCloneFactory &clone_factory);
356+ #endif
332357
333358 void kill () { wasm_base_ = nullptr ; }
334359
@@ -356,7 +381,11 @@ class PluginHandleBase : public std::enable_shared_from_this<PluginHandleBase> {
356381 explicit PluginHandleBase (std::shared_ptr<WasmHandleBase> wasm_handle,
357382 std::shared_ptr<PluginBase> plugin)
358383 : plugin_(plugin), wasm_handle_(wasm_handle) {}
384+ #ifdef PROXY_WASM_CPP_HOST_MORE_VIRTUAL_METHODS
385+ virtual ~PluginHandleBase () {
386+ #else
359387 ~PluginHandleBase () {
388+ #endif
360389 if (wasm_handle_) {
361390 wasm_handle_->wasm ()->startShutdown (plugin_->key ());
362391 }
0 commit comments