| 1473 | } |
| 1474 | |
| 1475 | Status ListGateHooks(ServerContext*, const EmptyRequest*, |
| 1476 | ListGateHooksResponse* response) override { |
| 1477 | std::lock_guard<std::recursive_mutex> lock(mutex_); |
| 1478 | |
| 1479 | for (const auto& pair : ModuleGraph::GetAllModules()) { |
| 1480 | const Module* m = pair.second; |
| 1481 | for (auto& gate : m->igates()) { |
| 1482 | if (!gate) { |
| 1483 | continue; |
| 1484 | } |
| 1485 | for (auto& hook : gate->hooks()) { |
| 1486 | GateHookInfo* info = response->add_hooks(); |
| 1487 | info->set_class_name(hook->class_name()); |
| 1488 | info->set_hook_name(hook->name()); |
| 1489 | info->set_module_name(m->name()); |
| 1490 | info->set_igate(gate->gate_idx()); |
| 1491 | *(info->mutable_arg()) = hook->arg(); |
| 1492 | } |
| 1493 | } |
| 1494 | for (auto& gate : m->ogates()) { |
| 1495 | if (!gate) { |
| 1496 | continue; |
| 1497 | } |
| 1498 | for (auto& hook : gate->hooks()) { |
| 1499 | GateHookInfo* info = response->add_hooks(); |
| 1500 | info->set_class_name(hook->class_name()); |
| 1501 | info->set_hook_name(hook->name()); |
| 1502 | info->set_module_name(m->name()); |
| 1503 | info->set_ogate(gate->gate_idx()); |
| 1504 | *(info->mutable_arg()) = hook->arg(); |
| 1505 | } |
| 1506 | } |
| 1507 | } |
| 1508 | return Status::OK; |
| 1509 | } |
| 1510 | |
| 1511 | Status ConfigureGateHook(ServerContext*, |
| 1512 | const ConfigureGateHookRequest* request, |
nothing calls this directly
no test coverage detected