| 153 | } |
| 154 | |
| 155 | bool ContextBase::onConfigure(std::shared_ptr<PluginBase> plugin) { |
| 156 | if (isFailed()) { |
| 157 | return true; |
| 158 | } |
| 159 | |
| 160 | // on_context_create is yet to be executed for all the root contexts except the first one |
| 161 | if (!in_vm_context_created_ && wasm_->on_context_create_) { |
| 162 | DeferAfterCallActions actions(this); |
| 163 | wasm_->on_context_create_(this, id_, 0); |
| 164 | } |
| 165 | |
| 166 | // NB: If no on_context_create function is registered the in-VM SDK is responsible for |
| 167 | // managing any required in-VM state. |
| 168 | in_vm_context_created_ = true; |
| 169 | |
| 170 | if (!wasm_->on_configure_) { |
| 171 | return true; |
| 172 | } |
| 173 | |
| 174 | DeferAfterCallActions actions(this); |
| 175 | temp_plugin_ = plugin; |
| 176 | auto result = |
| 177 | wasm_->on_configure_(this, id_, static_cast<uint32_t>(plugin->plugin_configuration_.size())) |
| 178 | .u64_ != 0; |
| 179 | temp_plugin_.reset(); |
| 180 | return result; |
| 181 | } |
| 182 | |
| 183 | void ContextBase::onCreate() { |
| 184 | if (!isFailed() && !in_vm_context_created_ && wasm_->on_context_create_) { |