@@ -54,18 +54,18 @@ class WasmBase : public std::enable_shared_from_this<WasmBase> {
54
54
WasmBase (const std::shared_ptr<WasmHandleBase> &base_wasm_handle, const WasmVmFactory &factory);
55
55
virtual ~WasmBase ();
56
56
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);
61
61
// 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);
63
63
64
64
std::string_view vm_id () const { return vm_id_; }
65
65
std::string_view vm_key () const { return vm_key_; }
66
66
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);
69
69
ContextBase *getContext (uint32_t id) {
70
70
auto it = contexts_.find (id);
71
71
if (it != contexts_.end ())
@@ -321,14 +321,14 @@ using WasmHandleCloneFactory =
321
321
class WasmHandleBase : public std ::enable_shared_from_this<WasmHandleBase> {
322
322
public:
323
323
explicit WasmHandleBase (std::shared_ptr<WasmBase> wasm_base) : wasm_base_(wasm_base) {}
324
- ~WasmHandleBase () {
324
+ virtual ~WasmHandleBase () {
325
325
if (wasm_base_) {
326
326
wasm_base_->startShutdown ();
327
327
}
328
328
}
329
329
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);
332
332
333
333
void kill () { wasm_base_ = nullptr ; }
334
334
@@ -356,7 +356,7 @@ class PluginHandleBase : public std::enable_shared_from_this<PluginHandleBase> {
356
356
explicit PluginHandleBase (std::shared_ptr<WasmHandleBase> wasm_handle,
357
357
std::shared_ptr<PluginBase> plugin)
358
358
: plugin_(plugin), wasm_handle_(wasm_handle) {}
359
- ~PluginHandleBase () {
359
+ virtual ~PluginHandleBase () {
360
360
if (wasm_handle_) {
361
361
wasm_handle_->wasm ()->startShutdown (plugin_->key ());
362
362
}
0 commit comments