Add IS_TIZEN_DA to fix build break in standard build.
[platform/framework/web/chromium-efl.git] / net / quic / set_quic_flag.cc
1 // Copyright 2022 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/quic/set_quic_flag.h"
6
7 #include "base/strings/string_number_conversions.h"
8 #include "net/third_party/quiche/src/quiche/common/platform/api/quiche_flags.h"
9 #include "net/third_party/quiche/src/quiche/quic/platform/api/quic_flags.h"
10
11 namespace net {
12
13 namespace {
14
15 void SetQuicFlagByName_bool(bool* flag, const std::string& value) {
16   if (value == "true" || value == "True")
17     *flag = true;
18   else if (value == "false" || value == "False")
19     *flag = false;
20 }
21 void SetQuicFlagByName_double(double* flag, const std::string& value) {
22   double val;
23   if (base::StringToDouble(value, &val))
24     *flag = val;
25 }
26
27 void SetQuicFlagByName_uint64_t(uint64_t* flag, const std::string& value) {
28   uint64_t val;
29   if (base::StringToUint64(value, &val) && val >= 0)
30     *flag = val;
31 }
32
33 void SetQuicFlagByName_int32_t(int32_t* flag, const std::string& value) {
34   int val;
35   if (base::StringToInt(value, &val))
36     *flag = val;
37 }
38
39 void SetQuicFlagByName_int64_t(int64_t* flag, const std::string& value) {
40   int64_t val;
41   if (base::StringToInt64(value, &val))
42     *flag = val;
43 }
44
45 }  // namespace
46
47 void SetQuicFlagByName(const std::string& flag_name, const std::string& value) {
48 #define QUIC_FLAG(flag, default_value)            \
49   if (flag_name == "FLAGS_" #flag) {              \
50     SetQuicFlagByName_bool(&FLAGS_##flag, value); \
51     return;                                       \
52   }
53 #include "net/third_party/quiche/src/quiche/quic/core/quic_flags_list.h"
54 #undef QUIC_FLAG
55
56 #define QUIC_PROTOCOL_FLAG(type, flag, ...)         \
57   if (flag_name == "FLAGS_" #flag) {                \
58     SetQuicFlagByName_##type(&FLAGS_##flag, value); \
59     return;                                         \
60   }
61 #include "net/third_party/quiche/src/quiche/quic/core/quic_protocol_flags_list.h"
62 #undef QUIC_PROTOCOL_FLAG
63 }
64
65 }  // namespace net