Bug 1100501 - Add StatisticsRecorder initialization to xpcshell. r=georg, a=sledru
authorJim Mathies <jmathies@mozilla.com>
Sat, 11 Apr 2015 07:02:29 -0500
changeset 260235 71d1d59db847
parent 260234 8d4a0b33d32e
child 260236 8661ed4cbdb9
push id724
push userryanvm@gmail.com
push date2015-04-23 01:08 +0000
treeherdermozilla-release@db41e8e267ed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgeorg, sledru
bugs1100501
milestone38.0
Bug 1100501 - Add StatisticsRecorder initialization to xpcshell. r=georg, a=sledru
js/xpconnect/src/XPCShellImpl.cpp
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -27,16 +27,18 @@
 #include "nsAutoPtr.h"
 #include "nsJSPrincipals.h"
 #include "xpcpublic.h"
 #include "BackstagePass.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIPrincipal.h"
 #include "nsJSUtils.h"
 
+#include "base/histogram.h"
+
 #ifdef ANDROID
 #include <android/log.h>
 #endif
 
 #ifdef XP_WIN
 #include <windows.h>
 #endif
 
@@ -1240,16 +1242,21 @@ XRE_XPCShellMain(int argc, char** argv, 
     nsresult rv;
 
     gErrFile = stderr;
     gOutFile = stdout;
     gInFile = stdin;
 
     NS_LogInit();
 
+    // A initializer to initialize histogram collection
+    // used by telemetry.
+    UniquePtr<base::StatisticsRecorder> telStats =
+       MakeUnique<base::StatisticsRecorder>();
+
     nsCOMPtr<nsIFile> appFile;
     rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appFile));
     if (NS_FAILED(rv)) {
         printf("Couldn't find application file.\n");
         return 1;
     }
     nsCOMPtr<nsIFile> appDir;
     rv = appFile->GetParent(getter_AddRefs(appDir));
@@ -1530,16 +1537,17 @@ XRE_XPCShellMain(int argc, char** argv, 
 
 #ifdef TEST_CALL_ON_WRAPPED_JS_AFTER_SHUTDOWN
     // test of late call and release (see above)
     JSContext* bogusCX;
     bogus->Peek(&bogusCX);
     bogus = nullptr;
 #endif
 
+    telStats = nullptr;
     appDir = nullptr;
     appFile = nullptr;
     dirprovider.ClearGREDirs();
     dirprovider.ClearAppDir();
     dirprovider.ClearPluginDir();
     dirprovider.ClearAppFile();
 
 #ifdef MOZ_CRASHREPORTER