@@ -54,18 +54,18 @@ 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- bool load (const std::string &code, bool allow_precompiled = false );
58- bool initialize ();
59- void startVm (ContextBase *root_context);
60- bool configure (ContextBase *root_context, std::shared_ptr<PluginBase> plugin);
57+ virtual bool load (const std::string &code, bool allow_precompiled = false );
58+ virtual bool initialize ();
59+ virtual void startVm (ContextBase *root_context);
60+ virtual bool configure (ContextBase *root_context, std::shared_ptr<PluginBase> plugin);
6161 // Returns the root ContextBase or nullptr if onStart returns false.
62- ContextBase *start (const std::shared_ptr<PluginBase> &plugin);
62+ virtual ContextBase *start (const std::shared_ptr<PluginBase> &plugin);
6363
6464 std::string_view vm_id () const { return vm_id_; }
6565 std::string_view vm_key () const { return vm_key_; }
6666 WasmVm *wasm_vm () const { return wasm_vm_.get (); }
67- ContextBase *vm_context () const { return vm_context_.get (); }
68- ContextBase *getRootContext (const std::shared_ptr<PluginBase> &plugin, bool allow_closed);
67+ virtual ContextBase *vm_context () const { return vm_context_.get (); }
68+ virtual ContextBase *getRootContext (const std::shared_ptr<PluginBase> &plugin, bool allow_closed);
6969 ContextBase *getContext (uint32_t id) {
7070 auto it = contexts_.find (id);
7171 if (it != contexts_.end ())
@@ -321,14 +321,14 @@ using WasmHandleCloneFactory =
321321class WasmHandleBase : public std ::enable_shared_from_this<WasmHandleBase> {
322322public:
323323 explicit WasmHandleBase (std::shared_ptr<WasmBase> wasm_base) : wasm_base_(wasm_base) {}
324- ~WasmHandleBase () {
324+ virtual ~WasmHandleBase () {
325325 if (wasm_base_) {
326326 wasm_base_->startShutdown ();
327327 }
328328 }
329329
330- bool canary (const std::shared_ptr<PluginBase> &plugin,
331- const WasmHandleCloneFactory &clone_factory);
330+ virtual bool canary (const std::shared_ptr<PluginBase> &plugin,
331+ const WasmHandleCloneFactory &clone_factory);
332332
333333 void kill () { wasm_base_ = nullptr ; }
334334
@@ -356,7 +356,7 @@ class PluginHandleBase : public std::enable_shared_from_this<PluginHandleBase> {
356356 explicit PluginHandleBase (std::shared_ptr<WasmHandleBase> wasm_handle,
357357 std::shared_ptr<PluginBase> plugin)
358358 : plugin_(plugin), wasm_handle_(wasm_handle) {}
359- ~PluginHandleBase () {
359+ virtual ~PluginHandleBase () {
360360 if (wasm_handle_) {
361361 wasm_handle_->wasm ()->startShutdown (plugin_->key ());
362362 }
0 commit comments