Refactor QUICHE platform flag accessors. Move reloadable and restart flags accessor implementations from http2, quic, and spdy platform directories to quiche/common/platform, removing some code duplication, and making all accessors available from all three components. Flag count macros, protocol flags, and flag saver are not touched by this CL. PiperOrigin-RevId: 348657424 Change-Id: I5a2bbbb66c62bf920454e6b5bbbf41a3b5f54312
diff --git a/common/platform/api/quiche_flags.h b/common/platform/api/quiche_flags.h new file mode 100644 index 0000000..83db9d0 --- /dev/null +++ b/common/platform/api/quiche_flags.h
@@ -0,0 +1,21 @@ +// Copyright 2020 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_API_QUICHE_FLAGS_H_ +#define QUICHE_COMMON_PLATFORM_API_QUICHE_FLAGS_H_ + +#include "net/quiche/common/platform/impl/quiche_flags_impl.h" + +#define GetQuicheReloadableFlag(module, flag) \ + GetQuicheReloadableFlagImpl(module, flag) +#define SetQuicheReloadableFlag(module, flag, value) \ + SetQuicheReloadableFlagImpl(module, flag, value) +#define GetQuicheRestartFlag(module, flag) \ + GetQuicheRestartFlagImpl(module, flag) +#define SetQuicheRestartFlag(module, flag, value) \ + SetQuicheRestartFlagImpl(module, flag, value) +#define GetQuicheFlag(flag) GetQuicheFlagImpl(flag) +#define SetQuicheFlag(flag, value) SetQuicheFlagImpl(flag, value) + +#endif // QUICHE_COMMON_PLATFORM_API_QUICHE_FLAGS_H_
diff --git a/http2/platform/api/http2_flags.h b/http2/platform/api/http2_flags.h index 08f95da..df84e34 100644 --- a/http2/platform/api/http2_flags.h +++ b/http2/platform/api/http2_flags.h
@@ -5,10 +5,15 @@ #ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_FLAGS_H_ #define QUICHE_HTTP2_PLATFORM_API_HTTP2_FLAGS_H_ -#include "net/http2/platform/impl/http2_flags_impl.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_flags.h" -#define GetHttp2ReloadableFlag(flag) GetHttp2ReloadableFlagImpl(flag) +#define GetHttp2ReloadableFlag(flag) GetQuicheReloadableFlag(http2, flag) #define SetHttp2ReloadableFlag(flag, value) \ - SetHttp2ReloadableFlagImpl(flag, value) + SetQuicheReloadableFlag(http2, flag, value) +#define GetHttp2RestartFlag(flag) GetQuicheRestartFlag(http2, flag) +#define SetHttp2RestartFlag(flag, value) \ + SetQuicheRestartFlag(http2, flag, value) +#define GetHttp2Flag(flag) GetQuicheFlag(flag) +#define SetHttp2Flag(flag, value) SetQuicheFlag(flag, value) #endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_FLAGS_H_
diff --git a/quic/platform/api/quic_flags.h b/quic/platform/api/quic_flags.h index 302036f..3b98037 100644 --- a/quic/platform/api/quic_flags.h +++ b/quic/platform/api/quic_flags.h
@@ -10,19 +10,21 @@ #include "net/quic/platform/impl/quic_flags_impl.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_flags.h" + +#define GetQuicReloadableFlag(flag) GetQuicheReloadableFlag(quic, flag) +#define SetQuicReloadableFlag(flag, value) \ + SetQuicheReloadableFlag(quic, flag, value) +#define GetQuicRestartFlag(flag) GetQuicheRestartFlag(quic, flag) +#define SetQuicRestartFlag(flag, value) SetQuicheRestartFlag(quic, flag, value) +#define GetQuicFlag(flag) GetQuicheFlag(flag) +#define SetQuicFlag(flag, value) SetQuicheFlag(flag, value) + // Define a command-line flag that can be automatically set via // QuicParseCommandLineFlags(). #define DEFINE_QUIC_COMMAND_LINE_FLAG(type, name, default_value, help) \ DEFINE_QUIC_COMMAND_LINE_FLAG_IMPL(type, name, default_value, help) -#define GetQuicReloadableFlag(flag) GetQuicReloadableFlagImpl(flag) -#define SetQuicReloadableFlag(flag, value) \ - SetQuicReloadableFlagImpl(flag, value) -#define GetQuicRestartFlag(flag) GetQuicRestartFlagImpl(flag) -#define SetQuicRestartFlag(flag, value) SetQuicRestartFlagImpl(flag, value) -#define GetQuicFlag(flag) GetQuicFlagImpl(flag) -#define SetQuicFlag(flag, value) SetQuicFlagImpl(flag, value) - namespace quic { // Parses command-line flags, setting flag variables defined using
diff --git a/spdy/platform/api/spdy_flags.h b/spdy/platform/api/spdy_flags.h index f3446d9..35eaf92 100644 --- a/spdy/platform/api/spdy_flags.h +++ b/spdy/platform/api/spdy_flags.h
@@ -5,9 +5,14 @@ #ifndef QUICHE_SPDY_PLATFORM_API_SPDY_FLAGS_H_ #define QUICHE_SPDY_PLATFORM_API_SPDY_FLAGS_H_ -#include "net/spdy/platform/impl/spdy_flags_impl.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_flags.h" -#define GetSpdyReloadableFlag(flag) GetSpdyReloadableFlagImpl(flag) -#define GetSpdyRestartFlag(flag) GetSpdyRestartFlagImpl(flag) +#define GetSpdyReloadableFlag(flag) GetQuicheReloadableFlag(spdy, flag) +#define SetSpdyReloadableFlag(flag, value) \ + SetQuicheReloadableFlag(spdy, flag, value) +#define GetSpdyRestartFlag(flag) GetQuicheRestartFlag(spdy, flag) +#define SetSpdyRestartFlag(flag, value) SetQuicheRestartFlag(spdy, flag, value) +#define GetSpdyFlag(flag) GetQuicheFlag(flag) +#define SetSpdyFlag(flag, value) SetQuicheFlag(flag, value) #endif // QUICHE_SPDY_PLATFORM_API_SPDY_FLAGS_H_