Provide default implementation for QUIC protocol flags. This is a subset of Chrome implementation; Chrome implementation also provides SetQuicFlagByName(), which is only used in Chrome (it is not defined in google3). PiperOrigin-RevId: 428784597
diff --git a/common/platform/default/quiche_platform_impl/quic_flags_impl.cc b/common/platform/default/quiche_platform_impl/quic_flags_impl.cc new file mode 100644 index 0000000..81b1d8f --- /dev/null +++ b/common/platform/default/quiche_platform_impl/quic_flags_impl.cc
@@ -0,0 +1,29 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "quiche_platform_impl/quic_flags_impl.h" + +#define DEFINE_QUIC_PROTOCOL_FLAG_SINGLE_VALUE(type, flag, value, doc) \ + type FLAGS_##flag = value; + +#define DEFINE_QUIC_PROTOCOL_FLAG_TWO_VALUES(type, flag, internal_value, \ + external_value, doc) \ + type FLAGS_##flag = external_value; + +// Preprocessor macros can only have one definition. +// Select the right macro based on the number of arguments. +#define GET_6TH_ARG(arg1, arg2, arg3, arg4, arg5, arg6, ...) arg6 +#define QUIC_PROTOCOL_FLAG_MACRO_CHOOSER(...) \ + GET_6TH_ARG(__VA_ARGS__, DEFINE_QUIC_PROTOCOL_FLAG_TWO_VALUES, \ + DEFINE_QUIC_PROTOCOL_FLAG_SINGLE_VALUE) +#define QUIC_PROTOCOL_FLAG(...) \ + QUIC_PROTOCOL_FLAG_MACRO_CHOOSER(__VA_ARGS__)(__VA_ARGS__) + +#include "quic/core/quic_protocol_flags_list.h" + +#undef QUIC_PROTOCOL_FLAG +#undef QUIC_PROTOCOL_FLAG_MACRO_CHOOSER +#undef GET_6TH_ARG +#undef DEFINE_QUIC_PROTOCOL_FLAG_TWO_VALUES +#undef DEFINE_QUIC_PROTOCOL_FLAG_SINGLE_VALUE
diff --git a/common/platform/default/quiche_platform_impl/quic_flags_impl.h b/common/platform/default/quiche_platform_impl/quic_flags_impl.h new file mode 100644 index 0000000..b58d24d --- /dev/null +++ b/common/platform/default/quiche_platform_impl/quic_flags_impl.h
@@ -0,0 +1,18 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUIC_FLAGS_IMPL_H_ +#define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUIC_FLAGS_IMPL_H_ + +#include <string> + +#include "common/platform/api/quiche_export.h" +#include "common/platform/api/quiche_flags.h" + +#define QUIC_PROTOCOL_FLAG(type, flag, ...) \ + QUICHE_EXPORT_PRIVATE extern type FLAGS_##flag; +#include "quic/core/quic_protocol_flags_list.h" +#undef QUIC_PROTOCOL_FLAG + +#endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUIC_FLAGS_IMPL_H_
diff --git a/quic/platform/api/quic_flags.h b/quic/platform/api/quic_flags.h index 43f81d4..762e590 100644 --- a/quic/platform/api/quic_flags.h +++ b/quic/platform/api/quic_flags.h
@@ -8,8 +8,7 @@ #include <string> #include <vector> -#include "net/quic/platform/impl/quic_flags_impl.h" - +#include "quiche_platform_impl/quic_flags_impl.h" #include "common/platform/api/quiche_flags.h" #define GetQuicReloadableFlag(flag) GetQuicheReloadableFlag(quic, flag)