OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/hi_res_timer_manager.h" | 11 #include "app/hi_res_timer_manager.h" |
12 #include "app/l10n_util.h" | 12 #include "app/l10n_util.h" |
13 #include "app/resource_bundle.h" | 13 #include "app/resource_bundle.h" |
14 #include "app/system_monitor.h" | 14 #include "app/system_monitor.h" |
15 #include "base/at_exit.h" | 15 #include "base/at_exit.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/file_path.h" | 17 #include "base/file_path.h" |
18 #include "base/file_util.h" | 18 #include "base/file_util.h" |
| 19 #include "base/mac/scoped_nsautorelease_pool.h" |
19 #include "base/metrics/field_trial.h" | 20 #include "base/metrics/field_trial.h" |
20 #include "base/metrics/histogram.h" | 21 #include "base/metrics/histogram.h" |
21 #include "base/scoped_nsautorelease_pool.h" | |
22 #include "base/path_service.h" | 22 #include "base/path_service.h" |
23 #include "base/platform_thread.h" | 23 #include "base/platform_thread.h" |
24 #include "base/process_util.h" | 24 #include "base/process_util.h" |
25 #include "base/string_number_conversions.h" | 25 #include "base/string_number_conversions.h" |
26 #include "base/string_piece.h" | 26 #include "base/string_piece.h" |
27 #include "base/string_split.h" | 27 #include "base/string_split.h" |
28 #include "base/string_util.h" | 28 #include "base/string_util.h" |
29 #include "base/sys_string_conversions.h" | 29 #include "base/sys_string_conversions.h" |
30 #include "base/time.h" | 30 #include "base/time.h" |
31 #include "base/trace_event.h" | 31 #include "base/trace_event.h" |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 // - If you need to create a (persistent) object, heap allocate it and keep a | 912 // - If you need to create a (persistent) object, heap allocate it and keep a |
913 // |scoped_ptr| to it rather than allocating it on the stack. Otherwise | 913 // |scoped_ptr| to it rather than allocating it on the stack. Otherwise |
914 // I'll have to convert your code when I refactor. | 914 // I'll have to convert your code when I refactor. |
915 // - Unless your new code is just a couple of lines, factor it out into a | 915 // - Unless your new code is just a couple of lines, factor it out into a |
916 // function with a well-defined purpose. Do NOT just add it inline in | 916 // function with a well-defined purpose. Do NOT just add it inline in |
917 // |BrowserMain()|. | 917 // |BrowserMain()|. |
918 // Thanks! | 918 // Thanks! |
919 | 919 |
920 // TODO(viettrungluu): put the remainder into BrowserMainParts | 920 // TODO(viettrungluu): put the remainder into BrowserMainParts |
921 const CommandLine& parsed_command_line = parameters.command_line_; | 921 const CommandLine& parsed_command_line = parameters.command_line_; |
922 base::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; | 922 base::mac::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; |
923 | 923 |
924 FilePath user_data_dir; | 924 FilePath user_data_dir; |
925 #if defined(OS_WIN) | 925 #if defined(OS_WIN) |
926 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 926 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
927 #else | 927 #else |
928 // Getting the user data dir can fail if the directory isn't | 928 // Getting the user data dir can fail if the directory isn't |
929 // creatable, for example; on Windows in code below we bring up a | 929 // creatable, for example; on Windows in code below we bring up a |
930 // dialog prompting the user to pick a different directory. | 930 // dialog prompting the user to pick a different directory. |
931 // However, ProcessSingleton needs a real user_data_dir on Mac/Linux, | 931 // However, ProcessSingleton needs a real user_data_dir on Mac/Linux, |
932 // so it's better to fail here than fail mysteriously elsewhere. | 932 // so it's better to fail here than fail mysteriously elsewhere. |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 metrics->Stop(); | 1544 metrics->Stop(); |
1545 | 1545 |
1546 // browser_shutdown takes care of deleting browser_process, so we need to | 1546 // browser_shutdown takes care of deleting browser_process, so we need to |
1547 // release it. | 1547 // release it. |
1548 ignore_result(browser_process.release()); | 1548 ignore_result(browser_process.release()); |
1549 browser_shutdown::Shutdown(); | 1549 browser_shutdown::Shutdown(); |
1550 | 1550 |
1551 TRACE_EVENT_END("BrowserMain", 0, 0); | 1551 TRACE_EVENT_END("BrowserMain", 0, 0); |
1552 return result_code; | 1552 return result_code; |
1553 } | 1553 } |
OLD | NEW |