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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « chrome/app/DEPS ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/app/chrome_main_delegate.h" 5 #include "chrome/app/chrome_main_delegate.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string> 8 #include <string>
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 #endif 119 #endif
120 120
121 #if defined(OS_LINUX) 121 #if defined(OS_LINUX)
122 #include "base/environment.h" 122 #include "base/environment.h"
123 #endif 123 #endif
124 124
125 #if defined(OS_MACOSX) || defined(OS_WIN) 125 #if defined(OS_MACOSX) || defined(OS_WIN)
126 #include "chrome/browser/policy/policy_path_parser.h" 126 #include "chrome/browser/policy/policy_path_parser.h"
127 #endif 127 #endif
128 128
129 #if defined(OS_CHROMEOS)
130 #include "components/metrics/leak_detector/leak_detector.h"
131 #endif
132
129 #if !defined(DISABLE_NACL) 133 #if !defined(DISABLE_NACL)
130 #include "components/nacl/common/nacl_switches.h" 134 #include "components/nacl/common/nacl_switches.h"
131 #include "components/nacl/renderer/plugin/ppapi_entrypoints.h" 135 #include "components/nacl/renderer/plugin/ppapi_entrypoints.h"
132 #endif 136 #endif
133 137
134 #if defined(ENABLE_PLUGINS) && (defined(CHROME_MULTIPLE_DLL_CHILD) || \ 138 #if defined(ENABLE_PLUGINS) && (defined(CHROME_MULTIPLE_DLL_CHILD) || \
135 !defined(CHROME_MULTIPLE_DLL_BROWSER)) 139 !defined(CHROME_MULTIPLE_DLL_BROWSER))
136 #include "pdf/pdf.h" 140 #include "pdf/pdf.h"
137 #endif 141 #endif
138 142
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 #endif 636 #endif
633 637
634 if (command_line.HasSwitch(switches::kOriginTrialPublicKey)) { 638 if (command_line.HasSwitch(switches::kOriginTrialPublicKey)) {
635 chrome_content_client_.origin_trial_key_manager() 639 chrome_content_client_.origin_trial_key_manager()
636 ->SetPublicKeyFromASCIIString( 640 ->SetPublicKeyFromASCIIString(
637 command_line.GetSwitchValueASCII(switches::kOriginTrialPublicKey)); 641 command_line.GetSwitchValueASCII(switches::kOriginTrialPublicKey));
638 } 642 }
639 643
640 content::SetContentClient(&chrome_content_client_); 644 content::SetContentClient(&chrome_content_client_);
641 645
646 #if defined (OS_CHROMEOS)
647 // The TLS slot used by metrics::LeakDetector needs to be initialized early to
648 // ensure that it gets assigned a low slow number. If it gets initialized too
649 // late, the glibc TLS system will require a malloc call in order to allocate
650 // storage for a higher slot number. Normally that's not a problem, but in
651 // LeakDetector it will result in recursive alloc hook function calls.
652 metrics::LeakDetector::InitTLSSlot();
653 #endif
654
642 return false; 655 return false;
643 } 656 }
644 657
645 #if defined(OS_MACOSX) 658 #if defined(OS_MACOSX)
646 void ChromeMainDelegate::InitMacCrashReporter( 659 void ChromeMainDelegate::InitMacCrashReporter(
647 const base::CommandLine& command_line, 660 const base::CommandLine& command_line,
648 const std::string& process_type) { 661 const std::string& process_type) {
649 // TODO(mark): Right now, InitializeCrashpad() needs to be called after 662 // TODO(mark): Right now, InitializeCrashpad() needs to be called after
650 // CommandLine::Init() and chrome::RegisterPathProvider(). Ideally, Crashpad 663 // CommandLine::Init() and chrome::RegisterPathProvider(). Ideally, Crashpad
651 // initialization could occur sooner, preferably even before the framework 664 // initialization could occur sooner, preferably even before the framework
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 case version_info::Channel::CANARY: 1033 case version_info::Channel::CANARY:
1021 return true; 1034 return true;
1022 case version_info::Channel::DEV: 1035 case version_info::Channel::DEV:
1023 case version_info::Channel::BETA: 1036 case version_info::Channel::BETA:
1024 case version_info::Channel::STABLE: 1037 case version_info::Channel::STABLE:
1025 default: 1038 default:
1026 // Don't enable instrumentation. 1039 // Don't enable instrumentation.
1027 return false; 1040 return false;
1028 } 1041 }
1029 } 1042 }
OLDNEW
« 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