| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_main.h" | 5 #include "chrome/browser/browser_main.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/allocator/allocator_shim.h" |
| 11 #include "base/at_exit.h" | 12 #include "base/at_exit.h" |
| 12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 13 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
| 14 #include "base/file_path.h" | 15 #include "base/file_path.h" |
| 15 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 16 #include "base/mac/scoped_nsautorelease_pool.h" | 17 #include "base/mac/scoped_nsautorelease_pool.h" |
| 17 #include "base/metrics/field_trial.h" | 18 #include "base/metrics/field_trial.h" |
| 18 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
| 19 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 20 #include "base/process_util.h" | 21 #include "base/process_util.h" |
| (...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 // I'll have to convert your code when I refactor. | 1133 // I'll have to convert your code when I refactor. |
| 1133 // - Unless your new code is just a couple of lines, factor it out into a | 1134 // - Unless your new code is just a couple of lines, factor it out into a |
| 1134 // function with a well-defined purpose. Do NOT just add it inline in | 1135 // function with a well-defined purpose. Do NOT just add it inline in |
| 1135 // |BrowserMain()|. | 1136 // |BrowserMain()|. |
| 1136 // Thanks! | 1137 // Thanks! |
| 1137 | 1138 |
| 1138 // TODO(viettrungluu): put the remainder into BrowserMainParts | 1139 // TODO(viettrungluu): put the remainder into BrowserMainParts |
| 1139 const CommandLine& parsed_command_line = parameters.command_line_; | 1140 const CommandLine& parsed_command_line = parameters.command_line_; |
| 1140 base::mac::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; | 1141 base::mac::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; |
| 1141 | 1142 |
| 1143 #if defined(OS_WIN) |
| 1144 // Make this call before going multithreaded, or spawning any subprocesses. |
| 1145 base::allocator::SetupSubprocessAllocator(); |
| 1146 #endif // OS_WIN |
| 1147 |
| 1142 FilePath user_data_dir; | 1148 FilePath user_data_dir; |
| 1143 #if defined(OS_WIN) | 1149 #if defined(OS_WIN) |
| 1144 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 1150 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
| 1145 #else | 1151 #else |
| 1146 // Getting the user data dir can fail if the directory isn't | 1152 // Getting the user data dir can fail if the directory isn't |
| 1147 // creatable, for example; on Windows in code below we bring up a | 1153 // creatable, for example; on Windows in code below we bring up a |
| 1148 // dialog prompting the user to pick a different directory. | 1154 // dialog prompting the user to pick a different directory. |
| 1149 // However, ProcessSingleton needs a real user_data_dir on Mac/Linux, | 1155 // However, ProcessSingleton needs a real user_data_dir on Mac/Linux, |
| 1150 // so it's better to fail here than fail mysteriously elsewhere. | 1156 // so it's better to fail here than fail mysteriously elsewhere. |
| 1151 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) | 1157 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1850 #if defined(OS_CHROMEOS) | 1856 #if defined(OS_CHROMEOS) |
| 1851 // To be precise, logout (browser shutdown) is not yet done, but the | 1857 // To be precise, logout (browser shutdown) is not yet done, but the |
| 1852 // remaining work is negligible, hence we say LogoutDone here. | 1858 // remaining work is negligible, hence we say LogoutDone here. |
| 1853 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 1859 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
| 1854 false); | 1860 false); |
| 1855 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 1861 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
| 1856 #endif | 1862 #endif |
| 1857 TRACE_EVENT_END("BrowserMain", 0, 0); | 1863 TRACE_EVENT_END("BrowserMain", 0, 0); |
| 1858 return result_code; | 1864 return result_code; |
| 1859 } | 1865 } |
| OLD | NEW |