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