OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 <windows.h> | 5 #include <windows.h> |
6 #include <shellapi.h> | 6 #include <shellapi.h> |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/histogram.h" | 12 #include "base/histogram.h" |
13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
16 #include "base/registry.h" | 16 #include "base/registry.h" |
17 #include "base/string_piece.h" | 17 #include "base/string_piece.h" |
18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 19 #include "base/system_monitor.h" |
19 #include "base/tracked_objects.h" | 20 #include "base/tracked_objects.h" |
20 #include "base/win_util.h" | 21 #include "base/win_util.h" |
21 #include "chrome/app/result_codes.h" | 22 #include "chrome/app/result_codes.h" |
22 #include "chrome/browser/automation/automation_provider.h" | 23 #include "chrome/browser/automation/automation_provider.h" |
23 #include "chrome/browser/browser.h" | 24 #include "chrome/browser/browser.h" |
24 #include "chrome/browser/browser_init.h" | 25 #include "chrome/browser/browser_init.h" |
25 #include "chrome/browser/browser_list.h" | 26 #include "chrome/browser/browser_list.h" |
26 #include "chrome/browser/browser_prefs.h" | 27 #include "chrome/browser/browser_prefs.h" |
27 #include "chrome/browser/browser_process_impl.h" | 28 #include "chrome/browser/browser_process_impl.h" |
28 #include "chrome/browser/browser_shutdown.h" | 29 #include "chrome/browser/browser_shutdown.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 sandbox::BrokerServices* broker_services) { | 282 sandbox::BrokerServices* broker_services) { |
282 // WARNING: If we get a WM_ENDSESSION objects created on the stack here | 283 // WARNING: If we get a WM_ENDSESSION objects created on the stack here |
283 // are NOT deleted. If you need something to run during WM_ENDSESSION add it | 284 // are NOT deleted. If you need something to run during WM_ENDSESSION add it |
284 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. | 285 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. |
285 | 286 |
286 // TODO(beng, brettw): someday, break this out into sub functions with well | 287 // TODO(beng, brettw): someday, break this out into sub functions with well |
287 // defined roles (e.g. pre/post-profile startup, etc). | 288 // defined roles (e.g. pre/post-profile startup, etc). |
288 | 289 |
289 MessageLoop main_message_loop(MessageLoop::TYPE_UI); | 290 MessageLoop main_message_loop(MessageLoop::TYPE_UI); |
290 | 291 |
| 292 // Initialize the SystemMonitor |
| 293 base::SystemMonitor::Start(); |
| 294 |
291 // Initialize statistical testing infrastructure. | 295 // Initialize statistical testing infrastructure. |
292 FieldTrialList field_trial; | 296 FieldTrialList field_trial; |
293 | 297 |
294 std::wstring app_name = chrome::kBrowserAppName; | 298 std::wstring app_name = chrome::kBrowserAppName; |
295 std::string thread_name_string = WideToASCII(app_name + L"_BrowserMain"); | 299 std::string thread_name_string = WideToASCII(app_name + L"_BrowserMain"); |
296 | 300 |
297 const char* thread_name = thread_name_string.c_str(); | 301 const char* thread_name = thread_name_string.c_str(); |
298 PlatformThread::SetName(thread_name); | 302 PlatformThread::SetName(thread_name); |
299 main_message_loop.set_thread_name(thread_name); | 303 main_message_loop.set_thread_name(thread_name); |
300 bool already_running = Upgrade::IsBrowserAlreadyRunning(); | 304 bool already_running = Upgrade::IsBrowserAlreadyRunning(); |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 // The following should ONLY be called when in single threaded mode. It is | 604 // The following should ONLY be called when in single threaded mode. It is |
601 // unsafe to do this cleanup if other threads are still active. | 605 // unsafe to do this cleanup if other threads are still active. |
602 // It is also very unnecessary, so I'm only doing this in debug to satisfy | 606 // It is also very unnecessary, so I'm only doing this in debug to satisfy |
603 // purify. | 607 // purify. |
604 if (tracking_objects) | 608 if (tracking_objects) |
605 tracked_objects::ThreadData::ShutdownSingleThreadedCleanup(); | 609 tracked_objects::ThreadData::ShutdownSingleThreadedCleanup(); |
606 #endif // NDEBUG | 610 #endif // NDEBUG |
607 | 611 |
608 return result_code; | 612 return result_code; |
609 } | 613 } |
OLD | NEW |