Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Side by Side Diff: third_party/tcmalloc/chromium/src/base/commandlineflags.h

Issue 281613004: Don't let tcmalloc read all kinds of env vars at startup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: profile Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2005, Google Inc. 1 // Copyright (c) 2005, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 std::string FLAGS_##name(value); \ 112 std::string FLAGS_##name(value); \
113 char FLAGS_no##name; \ 113 char FLAGS_no##name; \
114 } \ 114 } \
115 using FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead::FLAGS_## name 115 using FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead::FLAGS_## name
116 116
117 // These macros (could be functions, but I don't want to bother with a .cc 117 // These macros (could be functions, but I don't want to bother with a .cc
118 // file), make it easier to initialize flags from the environment. 118 // file), make it easier to initialize flags from the environment.
119 // They are functions in Android because __system_property_get() doesn't 119 // They are functions in Android because __system_property_get() doesn't
120 // return a string. 120 // return a string.
121 121
122 #if defined(ENABLE_PROFILING)
123
122 #if defined(__ANDROID__) || defined(ANDROID) 124 #if defined(__ANDROID__) || defined(ANDROID)
123 125
124 // Returns a pointer to a static variable. The string pointed by the returned 126 // Returns a pointer to a static variable. The string pointed by the returned
125 // pointer must not be modified. 127 // pointer must not be modified.
126 inline const char* const EnvToString(const char* envname, const char* dflt) { 128 inline const char* const EnvToString(const char* envname, const char* dflt) {
127 static char system_property_value[PROP_VALUE_MAX]; 129 static char system_property_value[PROP_VALUE_MAX];
128 if (__system_property_get(envname, system_property_value) > 0) 130 if (__system_property_get(envname, system_property_value) > 0)
129 return system_property_value; 131 return system_property_value;
130 return dflt; 132 return dflt;
131 } 133 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 (!getenv(envname) ? (dflt) : strtol(getenv(envname), NULL, 10)) 173 (!getenv(envname) ? (dflt) : strtol(getenv(envname), NULL, 10))
172 174
173 #define EnvToInt64(envname, dflt) \ 175 #define EnvToInt64(envname, dflt) \
174 (!getenv(envname) ? (dflt) : strtoll(getenv(envname), NULL, 10)) 176 (!getenv(envname) ? (dflt) : strtoll(getenv(envname), NULL, 10))
175 177
176 #define EnvToDouble(envname, dflt) \ 178 #define EnvToDouble(envname, dflt) \
177 (!getenv(envname) ? (dflt) : strtod(getenv(envname), NULL)) 179 (!getenv(envname) ? (dflt) : strtod(getenv(envname), NULL))
178 180
179 #endif // defined(__ANDROID__) || defined(ANDROID) 181 #endif // defined(__ANDROID__) || defined(ANDROID)
180 182
183 #else // defined(ENABLE_PROFILING)
184
185 #define EnvToString(envname, dflt) (dflt)
186 #define EnvToBool(envname, dflt) (dflt)
187 #define EnvToInt(envname, dflt) (dflt)
188 #define EnvToInt64(envname, dflt) (dflt)
189 #define EnvToDouble(envname, dflt) (dflt)
190
191 #endif // defined(ENABLE_PROFILING)
192
181 #endif // BASE_COMMANDLINEFLAGS_H_ 193 #endif // BASE_COMMANDLINEFLAGS_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698