1616#define THIRD_PARTY_CEL_CPP_RUNTIME_INTERNAL_RUNTIME_IMPL_H_
1717
1818#include < memory>
19+ #include < utility>
1920
21+ #include " absl/base/attributes.h"
22+ #include " absl/base/nullability.h"
23+ #include " absl/log/absl_check.h"
2024#include " absl/status/statusor.h"
2125#include " base/ast.h"
2226#include " base/type_provider.h"
2731#include " runtime/runtime.h"
2832#include " runtime/runtime_options.h"
2933#include " runtime/type_registry.h"
34+ #include " google/protobuf/descriptor.h"
3035
3136namespace cel ::runtime_internal {
3237
3338class RuntimeImpl : public Runtime {
3439 public:
3540 struct Environment {
41+ ABSL_ATTRIBUTE_UNUSED
42+ absl::Nonnull<std::shared_ptr<const google::protobuf::DescriptorPool>>
43+ descriptor_pool;
3644 TypeRegistry type_registry;
3745 FunctionRegistry function_registry;
3846 well_known_types::Reflection well_known_types;
3947 };
4048
41- explicit RuntimeImpl (const RuntimeOptions& options)
42- : environment_(std::make_shared<Environment>()),
49+ RuntimeImpl (absl::Nonnull<std::shared_ptr<Environment>> environment,
50+ const RuntimeOptions& options)
51+ : environment_(std::move(environment)),
4352 expr_builder_ (environment_->function_registry,
44- environment_->type_registry, options) {}
53+ environment_->type_registry, options) {
54+ ABSL_DCHECK (environment_->well_known_types .IsInitialized ());
55+ }
4556
4657 TypeRegistry& type_registry () { return environment_->type_registry ; }
4758 const TypeRegistry& type_registry () const {
@@ -55,9 +66,6 @@ class RuntimeImpl : public Runtime {
5566 return environment_->function_registry ;
5667 }
5768
58- well_known_types::Reflection& well_known_types () {
59- return environment_->well_known_types ;
60- }
6169 const well_known_types::Reflection& well_known_types () const {
6270 return environment_->well_known_types ;
6371 }
0 commit comments