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

Unified Diff: chrome/app/chrome_main_delegate.cc

Issue 2023133003: Add Static Initializer for leak detector TLS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Include protobuf header in unittest; Browser publicly depends on leak_detector Created 4 years, 6 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 | « chrome/app/DEPS ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/chrome_main_delegate.cc
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc
index 75286cc2d3c9065831aba8ffd88b5308d383bd6a..1626ff468513076ad064a3eef600a8dade50ee9b 100644
--- a/chrome/app/chrome_main_delegate.cc
+++ b/chrome/app/chrome_main_delegate.cc
@@ -126,6 +126,10 @@
#include "chrome/browser/policy/policy_path_parser.h"
#endif
+#if defined(OS_CHROMEOS)
+#include "components/metrics/leak_detector/leak_detector.h"
+#endif
+
#if !defined(DISABLE_NACL)
#include "components/nacl/common/nacl_switches.h"
#include "components/nacl/renderer/plugin/ppapi_entrypoints.h"
@@ -639,6 +643,15 @@ bool ChromeMainDelegate::BasicStartupComplete(int* exit_code) {
content::SetContentClient(&chrome_content_client_);
+#if defined (OS_CHROMEOS)
+ // The TLS slot used by metrics::LeakDetector needs to be initialized early to
+ // ensure that it gets assigned a low slow number. If it gets initialized too
+ // late, the glibc TLS system will require a malloc call in order to allocate
+ // storage for a higher slot number. Normally that's not a problem, but in
+ // LeakDetector it will result in recursive alloc hook function calls.
+ metrics::LeakDetector::InitTLSSlot();
+#endif
+
return false;
}
« no previous file with comments | « chrome/app/DEPS ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698