| 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/app/chrome_main.h" | 5 #include "chrome/app/chrome_main.h" |
| 6 | 6 |
| 7 #include "app/app_paths.h" | 7 #include "app/app_paths.h" |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/debugger.h" | 10 #include "base/debug/debugger.h" |
| 11 #include "base/i18n/icu_util.h" | 11 #include "base/i18n/icu_util.h" |
| 12 #include "base/mac/scoped_nsautorelease_pool.h" | 12 #include "base/mac/scoped_nsautorelease_pool.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/metrics/stats_counters.h" | 14 #include "base/metrics/stats_counters.h" |
| 15 #include "base/metrics/stats_table.h" | 15 #include "base/metrics/stats_table.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/process_util.h" | 17 #include "base/process_util.h" |
| 18 #include "base/stringprintf.h" |
| 18 #include "base/string_number_conversions.h" | 19 #include "base/string_number_conversions.h" |
| 19 #include "base/string_util.h" | |
| 20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
| 21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 22 #include "crypto/nss_util.h" | 22 #include "crypto/nss_util.h" |
| 23 #include "chrome/browser/defaults.h" | 23 #include "chrome/browser/defaults.h" |
| 24 #include "chrome/browser/diagnostics/diagnostics_main.h" | 24 #include "chrome/browser/diagnostics/diagnostics_main.h" |
| 25 #include "chrome/browser/platform_util.h" | 25 #include "chrome/browser/platform_util.h" |
| 26 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
| 27 #include "chrome/common/chrome_content_client.h" | 27 #include "chrome/common/chrome_content_client.h" |
| 28 #include "chrome/common/chrome_content_plugin_client.h" | 28 #include "chrome/common/chrome_content_plugin_client.h" |
| 29 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 42 #include "content/common/sandbox_init_wrapper.h" | 42 #include "content/common/sandbox_init_wrapper.h" |
| 43 #include "content/common/set_process_title.h" | 43 #include "content/common/set_process_title.h" |
| 44 #include "ipc/ipc_switches.h" | 44 #include "ipc/ipc_switches.h" |
| 45 #include "ui/base/resource/resource_bundle.h" | 45 #include "ui/base/resource/resource_bundle.h" |
| 46 #include "ui/base/ui_base_paths.h" | 46 #include "ui/base/ui_base_paths.h" |
| 47 #include "ui/base/ui_base_switches.h" | 47 #include "ui/base/ui_base_switches.h" |
| 48 | 48 |
| 49 #if defined(OS_WIN) | 49 #if defined(OS_WIN) |
| 50 #include <algorithm> | 50 #include <algorithm> |
| 51 #include <malloc.h> | 51 #include <malloc.h> |
| 52 #include "base/string_util.h" |
| 52 #include "base/win/registry.h" | 53 #include "base/win/registry.h" |
| 53 #include "sandbox/src/sandbox.h" | 54 #include "sandbox/src/sandbox.h" |
| 54 #include "tools/memory_watcher/memory_watcher.h" | 55 #include "tools/memory_watcher/memory_watcher.h" |
| 55 #endif | 56 #endif |
| 56 | 57 |
| 57 #if defined(OS_MACOSX) | 58 #if defined(OS_MACOSX) |
| 58 #include "base/mac/mac_util.h" | 59 #include "base/mac/mac_util.h" |
| 59 #include "base/mac/os_crash_dumps.h" | 60 #include "base/mac/os_crash_dumps.h" |
| 60 #include "base/mach_ipc_mac.h" | 61 #include "base/mach_ipc_mac.h" |
| 61 #include "chrome/app/breakpad_mac.h" | 62 #include "chrome/app/breakpad_mac.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 // Initialize the Stats Counters table. With this initialized, | 336 // Initialize the Stats Counters table. With this initialized, |
| 336 // the StatsViewer can be utilized to read counters outside of | 337 // the StatsViewer can be utilized to read counters outside of |
| 337 // Chrome. These lines can be commented out to effectively turn | 338 // Chrome. These lines can be commented out to effectively turn |
| 338 // counters 'off'. The table is created and exists for the life | 339 // counters 'off'. The table is created and exists for the life |
| 339 // of the process. It is not cleaned up. | 340 // of the process. It is not cleaned up. |
| 340 if (command_line.HasSwitch(switches::kEnableStatsTable) || | 341 if (command_line.HasSwitch(switches::kEnableStatsTable) || |
| 341 command_line.HasSwitch(switches::kEnableBenchmarking)) { | 342 command_line.HasSwitch(switches::kEnableBenchmarking)) { |
| 342 // NOTIMPLEMENTED: we probably need to shut this down correctly to avoid | 343 // NOTIMPLEMENTED: we probably need to shut this down correctly to avoid |
| 343 // leaking shared memory regions on posix platforms. | 344 // leaking shared memory regions on posix platforms. |
| 344 std::string statsfile = | 345 std::string statsfile = |
| 345 StringPrintf("%s-%u", chrome::kStatsFilename, | 346 base::StringPrintf("%s-%u", |
| 346 static_cast<unsigned int>(browser_pid)); | 347 chrome::kStatsFilename, |
| 348 static_cast<unsigned int>(browser_pid)); |
| 347 base::StatsTable *stats_table = new base::StatsTable(statsfile, | 349 base::StatsTable *stats_table = new base::StatsTable(statsfile, |
| 348 chrome::kStatsMaxThreads, chrome::kStatsMaxCounters); | 350 chrome::kStatsMaxThreads, chrome::kStatsMaxCounters); |
| 349 base::StatsTable::set_current(stats_table); | 351 base::StatsTable::set_current(stats_table); |
| 350 } | 352 } |
| 351 } | 353 } |
| 352 | 354 |
| 353 #if defined(OS_POSIX) | 355 #if defined(OS_POSIX) |
| 354 // Check for --version and --product-version; return true if we encountered | 356 // Check for --version and --product-version; return true if we encountered |
| 355 // one of these switches and should exit now. | 357 // one of these switches and should exit now. |
| 356 bool HandleVersionSwitches(const CommandLine& command_line) { | 358 bool HandleVersionSwitches(const CommandLine& command_line) { |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 | 816 |
| 815 if (SubprocessNeedsResourceBundle(process_type)) | 817 if (SubprocessNeedsResourceBundle(process_type)) |
| 816 ResourceBundle::CleanupSharedInstance(); | 818 ResourceBundle::CleanupSharedInstance(); |
| 817 | 819 |
| 818 logging::CleanupChromeLogging(); | 820 logging::CleanupChromeLogging(); |
| 819 | 821 |
| 820 chrome_main::LowLevelShutdown(); | 822 chrome_main::LowLevelShutdown(); |
| 821 | 823 |
| 822 return exit_code; | 824 return exit_code; |
| 823 } | 825 } |
| OLD | NEW |