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 265709 666642d3a68d0e69fa9332e081dbfa38df3c0441
parent 265708 1743823b8fca79843ccac7e894d94e7b76dd9a05
child 265710 3e7cacefa838730940622ea8f8c50d4fd8d9e68e
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgeorg, sledru
bugs1100501
milestone39.0a2
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
 
@@ -1237,16 +1239,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));
@@ -1527,16 +1534,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