| 150 | } |
| 151 | |
| 152 | void OpRegistry::Export(bool include_internal, OpList* ops) const { |
| 153 | mutex_lock lock(mu_); |
| 154 | MustCallDeferred(); |
| 155 | |
| 156 | std::vector<std::pair<string, const OpRegistrationData*>> sorted( |
| 157 | registry_.begin(), registry_.end()); |
| 158 | std::sort(sorted.begin(), sorted.end()); |
| 159 | |
| 160 | auto out = ops->mutable_op(); |
| 161 | out->Clear(); |
| 162 | out->Reserve(sorted.size()); |
| 163 | |
| 164 | for (const auto& item : sorted) { |
| 165 | if (include_internal || !absl::StartsWith(item.first, "_")) { |
| 166 | *out->Add() = item.second->op_def; |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | void OpRegistry::DeferRegistrations() { |
| 172 | mutex_lock lock(mu_); |