Index: chrome/browser/chromeos/external_metrics.cc |
=================================================================== |
--- chrome/browser/chromeos/external_metrics.cc (revision 69359) |
+++ chrome/browser/chromeos/external_metrics.cc (working copy) |
@@ -18,7 +18,9 @@ |
#include "base/metrics/histogram.h" |
#include "base/perftimer.h" |
#include "base/time.h" |
+#include "chrome/browser/browser_process.h" |
#include "chrome/browser/browser_thread.h" |
+#include "chrome/browser/metrics/metrics_service.h" |
#include "chrome/browser/metrics/user_metrics.h" |
// Steps to add an action. |
@@ -80,6 +82,18 @@ |
NewRunnableMethod(this, &ExternalMetrics::RecordActionUI, action)); |
} |
+void ExternalMetrics::RecordCrashUI(const std::string &action_string) { |
+ if (g_browser_process && g_browser_process->metrics_service()) { |
+ g_browser_process->metrics_service()->LogChromeOSCrash(action_string); |
+ } |
+} |
+ |
+void ExternalMetrics::RecordCrash(const std::string &crash_kind) { |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, FROM_HERE, |
+ NewRunnableMethod(this, &ExternalMetrics::RecordCrashUI, crash_kind)); |
petkov
2011/01/06 18:50:36
You probably want to stay on the file thread -- no
kmixter1
2011/01/14 00:07:02
I'm not sure either. Will defer to an owner of th
jar (doing other things)
2011/01/18 22:32:23
I believe jumping over to the UI thread is both co
|
+} |
+ |
void ExternalMetrics::RecordHistogram(const char* histogram_data) { |
int sample, min, max, nbuckets; |
char name[128]; // length must be consistent with sscanf format below. |
@@ -200,6 +214,8 @@ |
RecordLinearHistogram(value); |
} else if (strcmp(name, "useraction") == 0) { |
RecordAction(value); |
+ } else if (strcmp(name, "crash") == 0) { |
petkov
2011/01/06 18:50:36
keep the ifs sorted?
kmixter1
2011/01/14 00:07:02
Done.
|
+ RecordCrash(value); |
} else { |
LOG(ERROR) << "invalid event type: " << name; |
} |