OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 | 8 |
| 9 #include "app/hi_res_timer_manager.h" |
9 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 11 #include "app/resource_bundle.h" |
| 12 #include "app/system_monitor.h" |
11 #include "base/command_line.h" | 13 #include "base/command_line.h" |
12 #include "base/field_trial.h" | 14 #include "base/field_trial.h" |
13 #include "base/file_util.h" | 15 #include "base/file_util.h" |
14 #include "base/histogram.h" | 16 #include "base/histogram.h" |
15 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
16 #include "base/scoped_nsautorelease_pool.h" | 18 #include "base/scoped_nsautorelease_pool.h" |
17 #include "base/path_service.h" | 19 #include "base/path_service.h" |
18 #include "base/process_util.h" | 20 #include "base/process_util.h" |
19 #include "base/string_piece.h" | 21 #include "base/string_piece.h" |
20 #include "base/string_util.h" | 22 #include "base/string_util.h" |
21 #include "base/sys_string_conversions.h" | 23 #include "base/sys_string_conversions.h" |
22 #include "base/system_monitor.h" | |
23 #include "base/time.h" | 24 #include "base/time.h" |
24 #include "base/tracked_objects.h" | 25 #include "base/tracked_objects.h" |
25 #include "base/values.h" | 26 #include "base/values.h" |
26 #include "chrome/browser/browser_main_win.h" | 27 #include "chrome/browser/browser_main_win.h" |
27 #include "chrome/browser/browser_init.h" | 28 #include "chrome/browser/browser_init.h" |
28 #include "chrome/browser/browser_list.h" | 29 #include "chrome/browser/browser_list.h" |
29 #include "chrome/browser/browser_prefs.h" | 30 #include "chrome/browser/browser_prefs.h" |
30 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
31 #include "chrome/browser/browser_process_impl.h" | 32 #include "chrome/browser/browser_process_impl.h" |
32 #include "chrome/browser/browser_shutdown.h" | 33 #include "chrome/browser/browser_shutdown.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 } | 311 } |
311 #endif // OS_POSIX | 312 #endif // OS_POSIX |
312 | 313 |
313 // Do platform-specific things (such as finishing initializing Cocoa) | 314 // Do platform-specific things (such as finishing initializing Cocoa) |
314 // prior to instantiating the message loop. This could be turned into a | 315 // prior to instantiating the message loop. This could be turned into a |
315 // broadcast notification. | 316 // broadcast notification. |
316 Platform::WillInitializeMainMessageLoop(parameters); | 317 Platform::WillInitializeMainMessageLoop(parameters); |
317 | 318 |
318 MessageLoop main_message_loop(MessageLoop::TYPE_UI); | 319 MessageLoop main_message_loop(MessageLoop::TYPE_UI); |
319 | 320 |
320 // Initialize the SystemMonitor | 321 SystemMonitor system_monitor; |
321 base::SystemMonitor::Start(); | 322 HighResolutionTimerManager hi_res_timer_manager; |
322 #if defined(OS_WIN) | |
323 // We want to monitor system power state to adjust our high resolution | |
324 // timer settings. But it's necessary only on Windows. | |
325 base::Time::StartSystemMonitorObserver(); | |
326 #endif // defined(OS_WIN) | |
327 | 323 |
328 // Initialize statistical testing infrastructure. | 324 // Initialize statistical testing infrastructure. |
329 FieldTrialList field_trial; | 325 FieldTrialList field_trial; |
330 | 326 |
331 std::wstring app_name = chrome::kBrowserAppName; | 327 std::wstring app_name = chrome::kBrowserAppName; |
332 std::string thread_name_string = WideToASCII(app_name + L"_BrowserMain"); | 328 std::string thread_name_string = WideToASCII(app_name + L"_BrowserMain"); |
333 | 329 |
334 const char* thread_name = thread_name_string.c_str(); | 330 const char* thread_name = thread_name_string.c_str(); |
335 PlatformThread::SetName(thread_name); | 331 PlatformThread::SetName(thread_name); |
336 main_message_loop.set_thread_name(thread_name); | 332 main_message_loop.set_thread_name(thread_name); |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 if (metrics) | 897 if (metrics) |
902 metrics->Stop(); | 898 metrics->Stop(); |
903 | 899 |
904 // browser_shutdown takes care of deleting browser_process, so we need to | 900 // browser_shutdown takes care of deleting browser_process, so we need to |
905 // release it. | 901 // release it. |
906 browser_process.release(); | 902 browser_process.release(); |
907 browser_shutdown::Shutdown(); | 903 browser_shutdown::Shutdown(); |
908 | 904 |
909 return result_code; | 905 return result_code; |
910 } | 906 } |
OLD | NEW |