| 83 | } // namespace |
| 84 | |
| 85 | Status GetDescriptorPool( |
| 86 | Env* env, string const& descriptor_source, |
| 87 | protobuf::DescriptorPool const** desc_pool, |
| 88 | std::unique_ptr<protobuf::DescriptorPool>* owned_desc_pool) { |
| 89 | // Attempt to lookup the pool in the registry. |
| 90 | auto pool_fn = DescriptorPoolRegistry::Global()->Get(descriptor_source); |
| 91 | if (pool_fn != nullptr) { |
| 92 | return (*pool_fn)(desc_pool, owned_desc_pool); |
| 93 | } |
| 94 | |
| 95 | // If there is no pool function registered for the given source, let the |
| 96 | // runtime find the file or URL. |
| 97 | Status status = |
| 98 | GetDescriptorPoolFromFile(env, descriptor_source, owned_desc_pool); |
| 99 | if (status.ok()) { |
| 100 | *desc_pool = owned_desc_pool->get(); |
| 101 | return Status::OK(); |
| 102 | } |
| 103 | |
| 104 | status = GetDescriptorPoolFromBinary(descriptor_source, owned_desc_pool); |
| 105 | *desc_pool = owned_desc_pool->get(); |
| 106 | return status; |
| 107 | } |
| 108 | |
| 109 | } // namespace tensorflow |
no test coverage detected