| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 #include "chrome/browser/first_run/upgrade_util.h" | 6 #include "chrome/browser/first_run/upgrade_util.h" |
| 7 #include "components/startup_metric_utils/startup_metric_utils.h" | 7 #include "components/startup_metric_utils/startup_metric_utils.h" |
| 8 | 8 |
| 9 // The entry point for all invocations of Chromium, browser and renderer. On | 9 // The entry point for all invocations of Chromium, browser and renderer. On |
| 10 // windows, this does nothing but load chrome.dll and invoke its entry point in | 10 // windows, this does nothing but load chrome.dll and invoke its entry point in |
| 11 // order to make it easy to update the app from GoogleUpdate. We don't need | 11 // order to make it easy to update the app from GoogleUpdate. We don't need |
| 12 // that extra layer with on linux. | 12 // that extra layer with on linux. |
| 13 | 13 |
| 14 #if defined(ADDRESS_SANITIZER) && defined(GOOGLE_CHROME_BUILD) | |
| 15 // Default AddressSanitizer options for the official build. These do not affect | |
| 16 // tests or non-official Chromium builds. | |
| 17 // - disable the strict memcmp() checking (http://crbug.com/178677 and | |
| 18 // http://crbug.com/178404). | |
| 19 // - set the malloc_context_size (i.e. the size of stack traces collected by | |
| 20 // ASan for each malloc/free) to 5. These stack traces tend to accumulate | |
| 21 // very fast in applications using JIT (v8 in Chrome's case), see | |
| 22 // https://code.google.com/p/address-sanitizer/issues/detail?id=177 | |
| 23 // - disable the in-process symbolization, which isn't 100% compatible with | |
| 24 // the existing sandboxes and doesn't make much sense for stripped official | |
| 25 // binaries. | |
| 26 const char *kAsanDefaultOptions = | |
| 27 "malloc_context_size=5 strict_memcmp=0 symbolize=false"; | |
| 28 | |
| 29 // Override the default ASan options for the Google Chrome executable. | |
| 30 // __asan_default_options should not be instrumented, because it is called | |
| 31 // before ASan is initialized. | |
| 32 extern "C" | |
| 33 __attribute__((no_sanitize_address)) | |
| 34 const char *__asan_default_options() { | |
| 35 return kAsanDefaultOptions; | |
| 36 } | |
| 37 #endif | |
| 38 | |
| 39 extern "C" { | 14 extern "C" { |
| 40 int ChromeMain(int argc, const char** argv); | 15 int ChromeMain(int argc, const char** argv); |
| 41 } | 16 } |
| 42 | 17 |
| 43 int main(int argc, const char** argv) { | 18 int main(int argc, const char** argv) { |
| 44 startup_metric_utils::RecordExeMainEntryTime(); | 19 startup_metric_utils::RecordExeMainEntryTime(); |
| 45 int return_code = ChromeMain(argc, argv); | 20 int return_code = ChromeMain(argc, argv); |
| 46 | 21 |
| 47 #if defined(OS_LINUX) | 22 #if defined(OS_LINUX) |
| 48 // Launch a new instance if we're shutting down because we detected an | 23 // Launch a new instance if we're shutting down because we detected an |
| 49 // upgrade in the persistent mode. | 24 // upgrade in the persistent mode. |
| 50 upgrade_util::RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 25 upgrade_util::RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
| 51 #endif | 26 #endif |
| 52 | 27 |
| 53 return return_code; | 28 return return_code; |
| 54 } | 29 } |
| OLD | NEW |