OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/process_util.h" | 6 #include "base/process_util.h" |
7 | 7 |
8 // The entry point for all invocations of Chromium, browser and renderer. On | 8 // The entry point for all invocations of Chromium, browser and renderer. On |
9 // windows, this does nothing but load chrome.dll and invoke its entry point in | 9 // windows, this does nothing but load chrome.dll and invoke its entry point in |
10 // order to make it easy to update the app from GoogleUpdate. We don't need | 10 // order to make it easy to update the app from GoogleUpdate. We don't need |
11 // that extra layer with on linux. | 11 // that extra layer with on linux. |
12 // | 12 // |
13 // TODO(tc): This is similar to chrome_exe_main.mm. After it's more clear what | 13 // TODO(tc): This is similar to chrome_exe_main.mm. After it's more clear what |
14 // needs to go here, we should evaluate whether or not to merge this file with | 14 // needs to go here, we should evaluate whether or not to merge this file with |
15 // chrome_exe_main.mm. | 15 // chrome_exe_main.mm. |
16 | 16 |
17 extern "C" { | 17 extern "C" { |
18 int ChromeMain(int argc, const char** argv); | 18 int ChromeMain(int argc, const char** argv); |
19 | 19 |
20 #if defined(LINUX_USE_TCMALLOC) | 20 #if defined(OS_LINUX) && defined(USE_TCMALLOC) |
21 | 21 |
22 int tc_set_new_mode(int mode); | 22 int tc_set_new_mode(int mode); |
23 | 23 |
24 #endif // defined(LINUX_USE_TCMALLOC) | 24 #endif // defined(OS_LINUX) && defined(USE_TCMALLOC) |
25 | |
26 } | 25 } |
27 | 26 |
28 int main(int argc, const char** argv) { | 27 int main(int argc, const char** argv) { |
29 base::EnableTerminationOnHeapCorruption(); | 28 base::EnableTerminationOnHeapCorruption(); |
30 base::EnableTerminationOnOutOfMemory(); | 29 base::EnableTerminationOnOutOfMemory(); |
31 | 30 |
32 // NOTE(willchan): One might ask why this call is done here rather than in | 31 // NOTE(willchan): One might ask why this call is done here rather than in |
33 // process_util_linux.cc with the definition of | 32 // process_util_linux.cc with the definition of |
34 // EnableTerminationOnOutOfMemory(). That's because base shouldn't have a | 33 // EnableTerminationOnOutOfMemory(). That's because base shouldn't have a |
35 // dependency on TCMalloc. Really, we ought to have our allocator shim code | 34 // dependency on TCMalloc. Really, we ought to have our allocator shim code |
36 // implement this EnableTerminationOnOutOfMemory() function. Whateverz. This | 35 // implement this EnableTerminationOnOutOfMemory() function. Whateverz. This |
37 // works for now. | 36 // works for now. |
38 #if defined(LINUX_USE_TCMALLOC) | 37 #if defined(OS_LINUX) && defined(USE_TCMALLOC) |
39 // For tcmalloc, we need to tell it to behave like new. | 38 // For tcmalloc, we need to tell it to behave like new. |
40 tc_set_new_mode(1); | 39 tc_set_new_mode(1); |
41 #endif | 40 #endif |
42 | 41 |
43 // The exit manager is in charge of calling the dtors of singletons. | 42 // The exit manager is in charge of calling the dtors of singletons. |
44 // Win has one here, but we assert with multiples from BrowserMain() if we | 43 // Win has one here, but we assert with multiples from BrowserMain() if we |
45 // keep it. | 44 // keep it. |
46 // base::AtExitManager exit_manager; | 45 // base::AtExitManager exit_manager; |
47 | 46 |
48 #if defined(GOOGLE_CHROME_BUILD) | |
49 // TODO(tc): init crash reporter | |
50 #endif | |
51 | |
52 return ChromeMain(argc, argv); | 47 return ChromeMain(argc, argv); |
53 } | 48 } |
OLD | NEW |