From 51fd073b7c049206742a08f71ac919ad9097d303 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Wed, 24 Apr 2019 16:17:32 -0700 Subject: [PATCH] Don't add API to Optional --- src/core/ext/filters/client_channel/lb_policy/xds/xds.cc | 4 ++-- .../ext/filters/client_channel/resolver_result_parsing.cc | 4 ++-- src/core/lib/gprpp/optional.h | 5 +---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index 2070dfc696c..26d34e1b3f9 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -1530,8 +1530,8 @@ void XdsLb::UpdateLocked(UpdateArgs args) { return; } ProcessAddressesAndChannelArgsLocked(args.addresses, *args.args); - locality_map_.UpdateLocked(locality_serverlist_, child_policy_config_, - args_, this); + locality_map_.UpdateLocked(locality_serverlist_, child_policy_config_, args_, + this); // Update the existing fallback policy. The fallback policy config and/or the // fallback addresses may be new. if (fallback_policy_ != nullptr) UpdateFallbackPolicyLocked(); diff --git a/src/core/ext/filters/client_channel/resolver_result_parsing.cc b/src/core/ext/filters/client_channel/resolver_result_parsing.cc index e868cd70bc6..a3bb6b9969b 100644 --- a/src/core/ext/filters/client_channel/resolver_result_parsing.cc +++ b/src/core/ext/filters/client_channel/resolver_result_parsing.cc @@ -401,8 +401,8 @@ ClientChannelServiceConfigParser::ParseGlobalParams(const grpc_json* json, error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( "field:retryThrottling error:Duplicate entry")); } else { - Optional max_milli_tokens(false, 0); - Optional milli_token_ratio(false, 0); + Optional max_milli_tokens; + Optional milli_token_ratio; for (grpc_json* sub_field = field->child; sub_field != nullptr; sub_field = sub_field->next) { if (sub_field->key == nullptr) continue; diff --git a/src/core/lib/gprpp/optional.h b/src/core/lib/gprpp/optional.h index 5c519fe7ec0..fee081bc6b4 100644 --- a/src/core/lib/gprpp/optional.h +++ b/src/core/lib/gprpp/optional.h @@ -26,9 +26,6 @@ namespace grpc_core { template class Optional { public: - Optional() = default; - - Optional(bool set, T value) : set_(set), value_(value) {} void set(const T& val) { value_ = val; set_ = true; @@ -42,7 +39,7 @@ class Optional { private: bool set_ = false; - T value_; + T value_ = {}; }; } /* namespace grpc_core */