aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/transport/service_config.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib/transport/service_config.cc')
-rw-r--r--src/core/lib/transport/service_config.cc24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/core/lib/transport/service_config.cc b/src/core/lib/transport/service_config.cc
index cbafc33840..adcec8c444 100644
--- a/src/core/lib/transport/service_config.cc
+++ b/src/core/lib/transport/service_config.cc
@@ -152,8 +152,10 @@ static char* parse_json_method_name(grpc_json* json) {
// each name found, incrementing \a idx for each entry added.
// Returns false on error.
static bool parse_json_method_config(
- grpc_json* json, void* (*create_value)(const grpc_json* method_config_json),
- void* (*ref_value)(void* value), void (*unref_value)(void* value),
+ grpc_exec_ctx* exec_ctx, grpc_json* json,
+ void* (*create_value)(const grpc_json* method_config_json),
+ void* (*ref_value)(void* value),
+ void (*unref_value)(grpc_exec_ctx* exec_ctx, void* value),
grpc_slice_hash_table_entry* entries, size_t* idx) {
// Construct value.
void* method_config = create_value(json);
@@ -182,15 +184,16 @@ static bool parse_json_method_config(
}
success = true;
done:
- unref_value(method_config);
+ unref_value(exec_ctx, method_config);
gpr_strvec_destroy(&paths);
return success;
}
grpc_slice_hash_table* grpc_service_config_create_method_config_table(
- const grpc_service_config* service_config,
+ grpc_exec_ctx* exec_ctx, const grpc_service_config* service_config,
void* (*create_value)(const grpc_json* method_config_json),
- void* (*ref_value)(void* value), void (*unref_value)(void* value)) {
+ void* (*ref_value)(void* value),
+ void (*unref_value)(grpc_exec_ctx* exec_ctx, void* value)) {
const grpc_json* json = service_config->json_tree;
// Traverse parsed JSON tree.
if (json->type != GRPC_JSON_OBJECT || json->key != nullptr) return nullptr;
@@ -214,11 +217,11 @@ grpc_slice_hash_table* grpc_service_config_create_method_config_table(
size_t idx = 0;
for (grpc_json* method = field->child; method != nullptr;
method = method->next) {
- if (!parse_json_method_config(method, create_value, ref_value,
+ if (!parse_json_method_config(exec_ctx, method, create_value, ref_value,
unref_value, entries, &idx)) {
for (size_t i = 0; i < idx; ++i) {
- grpc_slice_unref_internal(entries[i].key);
- unref_value(entries[i].value);
+ grpc_slice_unref_internal(exec_ctx, entries[i].key);
+ unref_value(exec_ctx, entries[i].value);
}
gpr_free(entries);
return nullptr;
@@ -237,7 +240,8 @@ grpc_slice_hash_table* grpc_service_config_create_method_config_table(
return method_config_table;
}
-void* grpc_method_config_table_get(const grpc_slice_hash_table* table,
+void* grpc_method_config_table_get(grpc_exec_ctx* exec_ctx,
+ const grpc_slice_hash_table* table,
grpc_slice path) {
void* value = grpc_slice_hash_table_get(table, path);
// If we didn't find a match for the path, try looking for a wildcard
@@ -253,7 +257,7 @@ void* grpc_method_config_table_get(const grpc_slice_hash_table* table,
grpc_slice wildcard_path = grpc_slice_from_copied_string(buf);
gpr_free(buf);
value = grpc_slice_hash_table_get(table, wildcard_path);
- grpc_slice_unref_internal(wildcard_path);
+ grpc_slice_unref_internal(exec_ctx, wildcard_path);
gpr_free(path_str);
}
return value;