summaryrefslogtreecommitdiffstats
path: root/chrome/common/child_process_logging_mac.mm
diff options
context:
space:
mode:
authormnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-26 08:55:22 +0000
committermnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-26 08:55:22 +0000
commit6dde9d7f2a99851b0f84671832f072799dd3f8d5 (patch)
tree133dc5f7a37c0c1bf0e65f3ab32ef081a3c3f293 /chrome/common/child_process_logging_mac.mm
parent31de519d7a62e532c2bdded403a451c9f3f972da (diff)
downloadchromium_src-6dde9d7f2a99851b0f84671832f072799dd3f8d5.zip
chromium_src-6dde9d7f2a99851b0f84671832f072799dd3f8d5.tar.gz
chromium_src-6dde9d7f2a99851b0f84671832f072799dd3f8d5.tar.bz2
Make crash reporting client_id accessible through child_process_logging.
On Mac and Linux, keep the client id in a global variable kept by the child_process_logging implementations. This allows to read it in a thread safe fashion when starting a child process. Also replace std::string with statically allocated buffers for the various items we add to the crash reports. This allows to properly handle crashes upon shutdown (std::string would run its destructor, invalidating the memory). BUG=53231 TEST=Crash reporting should still work Review URL: http://codereview.chromium.org/3186028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57497 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/child_process_logging_mac.mm')
-rw-r--r--chrome/common/child_process_logging_mac.mm9
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/common/child_process_logging_mac.mm b/chrome/common/child_process_logging_mac.mm
index a53b4ed..04f4ca4 100644
--- a/chrome/common/child_process_logging_mac.mm
+++ b/chrome/common/child_process_logging_mac.mm
@@ -28,6 +28,10 @@ const char *kGPUVertexShaderVersionParamName = "vsver";
static SetCrashKeyValueFuncPtr g_set_key_func;
static ClearCrashKeyValueFuncPtr g_clear_key_func;
+// Account for the terminating null character.
+static const size_t kClientIdSize = 32 + 1;
+static char g_client_id[kClientIdSize];
+
void SetCrashKeyFunctions(SetCrashKeyValueFuncPtr set_key_func,
ClearCrashKeyValueFuncPtr clear_key_func) {
g_set_key_func = set_key_func;
@@ -93,6 +97,7 @@ void SetClientId(const std::string& client_id) {
std::string str(client_id);
ReplaceSubstringsAfterOffset(&str, 0, "-", "");
+ base::strlcpy(g_client_id, str.c_str(), kClientIdSize);
if (g_set_key_func)
SetClientIdImpl(str, g_set_key_func);
@@ -100,6 +105,10 @@ void SetClientId(const std::string& client_id) {
GoogleUpdateSettings::SetMetricsId(wstr);
}
+std::string GetClientId() {
+ return std::string(g_client_id);
+}
+
void SetActiveExtensions(const std::set<std::string>& extension_ids) {
// TODO(port)
}