OLD | NEW |
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/browser/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 #include <map> | 11 #include <map> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 #include <utility> | 14 #include <utility> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
| 17 #include "base/allocator/features.h" |
17 #include "base/at_exit.h" | 18 #include "base/at_exit.h" |
18 #include "base/base_switches.h" | 19 #include "base/base_switches.h" |
19 #include "base/bind.h" | 20 #include "base/bind.h" |
20 #include "base/command_line.h" | 21 #include "base/command_line.h" |
21 #include "base/debug/crash_logging.h" | 22 #include "base/debug/crash_logging.h" |
22 #include "base/debug/debugger.h" | 23 #include "base/debug/debugger.h" |
23 #include "base/feature_list.h" | 24 #include "base/feature_list.h" |
24 #include "base/files/file_path.h" | 25 #include "base/files/file_path.h" |
25 #include "base/files/file_util.h" | 26 #include "base/files/file_util.h" |
26 #include "base/logging.h" | 27 #include "base/logging.h" |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 TRACE_EVENT0("startup", | 1132 TRACE_EVENT0("startup", |
1132 "ChromeBrowserMainParts::PreCreateThreadsImpl:InitProfiling"); | 1133 "ChromeBrowserMainParts::PreCreateThreadsImpl:InitProfiling"); |
1133 // User wants to override default tracking status. | 1134 // User wants to override default tracking status. |
1134 std::string flag = | 1135 std::string flag = |
1135 parsed_command_line().GetSwitchValueASCII(switches::kEnableProfiling); | 1136 parsed_command_line().GetSwitchValueASCII(switches::kEnableProfiling); |
1136 // Default to basic profiling (no parent child support). | 1137 // Default to basic profiling (no parent child support). |
1137 tracked_objects::ThreadData::Status status = | 1138 tracked_objects::ThreadData::Status status = |
1138 tracked_objects::ThreadData::PROFILING_ACTIVE; | 1139 tracked_objects::ThreadData::PROFILING_ACTIVE; |
1139 if (flag.compare("0") != 0) | 1140 if (flag.compare("0") != 0) |
1140 status = tracked_objects::ThreadData::DEACTIVATED; | 1141 status = tracked_objects::ThreadData::DEACTIVATED; |
| 1142 |
| 1143 #if BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) |
| 1144 // If profiling is enabled and the heap shim is available, turn on heap |
| 1145 // tracking as well. |
| 1146 if (status != tracked_objects::ThreadData::DEACTIVATED) |
| 1147 base::debug::HeapUsageTracker::EnableHeapTracking(); |
| 1148 #endif |
| 1149 |
1141 tracked_objects::ThreadData::InitializeAndSetTrackingStatus(status); | 1150 tracked_objects::ThreadData::InitializeAndSetTrackingStatus(status); |
1142 } | 1151 } |
1143 | 1152 |
1144 local_state_ = InitializeLocalState( | 1153 local_state_ = InitializeLocalState( |
1145 local_state_task_runner.get(), parsed_command_line()); | 1154 local_state_task_runner.get(), parsed_command_line()); |
1146 | 1155 |
1147 #if !defined(OS_ANDROID) | 1156 #if !defined(OS_ANDROID) |
1148 // These members must be initialized before returning from this function. | 1157 // These members must be initialized before returning from this function. |
1149 master_prefs_.reset(new first_run::MasterPrefs); | 1158 master_prefs_.reset(new first_run::MasterPrefs); |
1150 // Android doesn't use StartupBrowserCreator. | 1159 // Android doesn't use StartupBrowserCreator. |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2228 chromeos::CrosSettings::Shutdown(); | 2237 chromeos::CrosSettings::Shutdown(); |
2229 #endif // defined(OS_CHROMEOS) | 2238 #endif // defined(OS_CHROMEOS) |
2230 #endif // defined(OS_ANDROID) | 2239 #endif // defined(OS_ANDROID) |
2231 } | 2240 } |
2232 | 2241 |
2233 // Public members: | 2242 // Public members: |
2234 | 2243 |
2235 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2244 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
2236 chrome_extra_parts_.push_back(parts); | 2245 chrome_extra_parts_.push_back(parts); |
2237 } | 2246 } |
OLD | NEW |