Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: components/cronet/android/cronet_library_loader.cc

Issue 2790063004: [Cronet] Initialize StatisticsRecorder early (Closed)
Patch Set: ios Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/cronet/android/cronet_url_request_context_adapter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/android/cronet_library_loader.cc
diff --git a/components/cronet/android/cronet_library_loader.cc b/components/cronet/android/cronet_library_loader.cc
index 6d4d11730c8c0cd7adb5e4f8711007a5841d9e15..7dda7a8748b426f5cccd2199a772ab19927066f4 100644
--- a/components/cronet/android/cronet_library_loader.cc
+++ b/components/cronet/android/cronet_library_loader.cc
@@ -18,6 +18,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
+#include "base/metrics/statistics_recorder.h"
#include "components/cronet/android/cronet_bidirectional_stream_adapter.h"
#include "components/cronet/android/cronet_upload_data_stream_adapter.h"
#include "components/cronet/android/cronet_url_request_adapter.h"
@@ -100,6 +101,9 @@ void CronetInitOnMainThread(JNIEnv* env, const JavaParamRef<jclass>& jcaller) {
DCHECK(!g_main_message_loop);
g_main_message_loop = new base::MessageLoopForUI();
base::MessageLoopForUI::current()->Start();
+ // Initializes the statistics recorder system. This needs to be done before
+ // emitting histograms to prevent memory leaks (crbug.com/707836).
+ base::StatisticsRecorder::Initialize();
xunjieli 2017/04/03 18:39:39 Doing this on the main UI thread because NetworkCh
DCHECK(!g_network_change_notifier);
net::NetworkChangeNotifier::SetFactory(
new net::NetworkChangeNotifierFactoryAndroid());
« no previous file with comments | « no previous file | components/cronet/android/cronet_url_request_context_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698