Chromium Code Reviews| 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()); |