summaryrefslogtreecommitdiffstats
path: root/third_party/tcmalloc/chromium/src
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-18 19:01:02 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-18 19:01:02 +0000
commit4ee52987bd786969f4d1ef8024a46d4be3da85aa (patch)
treeb84e7867f0364b317135640d3809251c3fd6fba0 /third_party/tcmalloc/chromium/src
parenta04be0557ab9114e0773e0332e8da3ca6dd83f41 (diff)
downloadchromium_src-4ee52987bd786969f4d1ef8024a46d4be3da85aa.zip
chromium_src-4ee52987bd786969f4d1ef8024a46d4be3da85aa.tar.gz
chromium_src-4ee52987bd786969f4d1ef8024a46d4be3da85aa.tar.bz2
tcmalloc: Let DEFINE_string define const char*s.
DEFINE_string is used in 3 files in tcmalloc, but we only compile one of these. In this one file, the string is converted to char every time it's used, and since the string is used after global destructors have run it needs to be copied to a second string in a static initializer. Instead of all that silliness, just let DEFINE_string define a const char* (like it does in v8 or webrtc). BUG=94925 R=willchan@chromium.org Review URL: https://codereview.chromium.org/286953011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271307 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/tcmalloc/chromium/src')
-rw-r--r--third_party/tcmalloc/chromium/src/base/commandlineflags.h11
-rw-r--r--third_party/tcmalloc/chromium/src/symbolize.cc9
2 files changed, 7 insertions, 13 deletions
diff --git a/third_party/tcmalloc/chromium/src/base/commandlineflags.h b/third_party/tcmalloc/chromium/src/base/commandlineflags.h
index 6d41e86..614be3a 100644
--- a/third_party/tcmalloc/chromium/src/base/commandlineflags.h
+++ b/third_party/tcmalloc/chromium/src/base/commandlineflags.h
@@ -59,13 +59,13 @@
#endif
#define DECLARE_VARIABLE(type, name) \
- namespace FLAG__namespace_do_not_use_directly_use_DECLARE_##type##_instead { \
+ namespace FLAG__namespace_do_not_use_directly_use_DECLARE_##type##_instead {\
extern PERFTOOLS_DLL_DECL type FLAGS_##name; \
} \
using FLAG__namespace_do_not_use_directly_use_DECLARE_##type##_instead::FLAGS_##name
#define DEFINE_VARIABLE(type, name, value, meaning) \
- namespace FLAG__namespace_do_not_use_directly_use_DECLARE_##type##_instead { \
+ namespace FLAG__namespace_do_not_use_directly_use_DECLARE_##type##_instead {\
PERFTOOLS_DLL_DECL type FLAGS_##name(value); \
char FLAGS_no##name; \
} \
@@ -100,16 +100,15 @@
#define DEFINE_double(name, value, meaning) \
DEFINE_VARIABLE(double, name, value, meaning)
-// Special case for string, because we have to specify the namespace
-// std::string, which doesn't play nicely with our FLAG__namespace hackery.
+// Special case for string, because of the pointer type.
#define DECLARE_string(name) \
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead { \
- extern std::string FLAGS_##name; \
+ extern const char* FLAGS_##name; \
} \
using FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead::FLAGS_##name
#define DEFINE_string(name, value, meaning) \
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead { \
- std::string FLAGS_##name(value); \
+ const char* FLAGS_##name = value; \
char FLAGS_no##name; \
} \
using FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead::FLAGS_##name
diff --git a/third_party/tcmalloc/chromium/src/symbolize.cc b/third_party/tcmalloc/chromium/src/symbolize.cc
index 65150f3..a1583ec 100644
--- a/third_party/tcmalloc/chromium/src/symbolize.cc
+++ b/third_party/tcmalloc/chromium/src/symbolize.cc
@@ -68,11 +68,6 @@ DEFINE_string(symbolize_pprof,
EnvToString("PPROF_PATH", "pprof"),
"Path to pprof to call for reporting function names.");
-// heap_profile_table_pprof may be referenced after destructors are
-// called (since that's when leak-checking is done), so we make
-// a more-permanent copy that won't ever get destroyed.
-static string* g_pprof_path = new string(FLAGS_symbolize_pprof);
-
// Returns NULL if we're on an OS where we can't get the invocation name.
// Using a static var is ok because we're not called from a thread.
static char* GetProgramInvocationName() {
@@ -129,7 +124,7 @@ int SymbolTable::Symbolize() {
PrintError("Cannot figure out the name of this executable (argv0)");
return 0;
}
- if (access(g_pprof_path->c_str(), R_OK) != 0) {
+ if (access(FLAGS_symbolize_pprof, R_OK) != 0) {
PrintError("Cannot find 'pprof' (is PPROF_PATH set correctly?)");
return 0;
}
@@ -191,7 +186,7 @@ int SymbolTable::Symbolize() {
unsetenv("HEAPPROFILE");
unsetenv("HEAPCHECK");
unsetenv("PERFTOOLS_VERBOSE");
- execlp(g_pprof_path->c_str(), g_pprof_path->c_str(),
+ execlp(FLAGS_symbolize_pprof, FLAGS_symbolize_pprof,
"--symbols", argv0, NULL);
_exit(3); // if execvp fails, it's bad news for us
}