| 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/mac/scoped_nsautorelease_pool.h" |
| 20 #include "base/metrics/field_trial.h" | 20 #include "base/metrics/field_trial.h" |
| 21 #include "base/metrics/histogram.h" | 21 #include "base/metrics/histogram.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/thread_restrictions.h" |
| 30 #include "base/time.h" | 31 #include "base/time.h" |
| 31 #include "base/trace_event.h" | 32 #include "base/trace_event.h" |
| 32 #include "base/utf_string_conversions.h" | 33 #include "base/utf_string_conversions.h" |
| 33 #include "base/values.h" | 34 #include "base/values.h" |
| 34 #include "build/build_config.h" | 35 #include "build/build_config.h" |
| 35 #include "chrome/browser/browser.h" | 36 #include "chrome/browser/browser.h" |
| 36 #include "chrome/browser/browser_main_win.h" | 37 #include "chrome/browser/browser_main_win.h" |
| 37 #include "chrome/browser/browser_init.h" | 38 #include "chrome/browser/browser_init.h" |
| 38 #include "chrome/browser/prefs/browser_prefs.h" | 39 #include "chrome/browser/prefs/browser_prefs.h" |
| 39 #include "chrome/browser/browser_process.h" | 40 #include "chrome/browser/browser_process.h" |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 // and 1 if it can't be. This is for validation that the library is installed | 472 // and 1 if it can't be. This is for validation that the library is installed |
| 472 // and versioned properly for Chrome to find. | 473 // and versioned properly for Chrome to find. |
| 473 if (command_line.HasSwitch(switches::kTestLoadLibcros)) | 474 if (command_line.HasSwitch(switches::kTestLoadLibcros)) |
| 474 exit(!chromeos::CrosLibrary::Get()->EnsureLoaded()); | 475 exit(!chromeos::CrosLibrary::Get()->EnsureLoaded()); |
| 475 #endif | 476 #endif |
| 476 } | 477 } |
| 477 | 478 |
| 478 void RunUIMessageLoop(BrowserProcess* browser_process) { | 479 void RunUIMessageLoop(BrowserProcess* browser_process) { |
| 479 TRACE_EVENT_BEGIN("BrowserMain:MESSAGE_LOOP", 0, ""); | 480 TRACE_EVENT_BEGIN("BrowserMain:MESSAGE_LOOP", 0, ""); |
| 480 | 481 |
| 482 #if defined(OS_LINUX) |
| 483 // If the UI thread blocks, the whole UI is unresponsive. |
| 484 // Do not allow disk IO from the UI thread. |
| 485 // TODO(evanm): turn this on for all platforms. |
| 486 // http://code.google.com/p/chromium/issues/detail?id=60211 |
| 487 base::ThreadRestrictions::SetIOAllowed(false); |
| 488 #endif |
| 489 |
| 481 #if defined(TOOLKIT_VIEWS) | 490 #if defined(TOOLKIT_VIEWS) |
| 482 views::AcceleratorHandler accelerator_handler; | 491 views::AcceleratorHandler accelerator_handler; |
| 483 MessageLoopForUI::current()->Run(&accelerator_handler); | 492 MessageLoopForUI::current()->Run(&accelerator_handler); |
| 484 #elif defined(USE_X11) | 493 #elif defined(USE_X11) |
| 485 MessageLoopForUI::current()->Run(NULL); | 494 MessageLoopForUI::current()->Run(NULL); |
| 486 #elif defined(OS_POSIX) | 495 #elif defined(OS_POSIX) |
| 487 MessageLoopForUI::current()->Run(); | 496 MessageLoopForUI::current()->Run(); |
| 488 #endif | 497 #endif |
| 489 | 498 |
| 490 TRACE_EVENT_END("BrowserMain:MESSAGE_LOOP", 0, ""); | 499 TRACE_EVENT_END("BrowserMain:MESSAGE_LOOP", 0, ""); |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 metrics->Stop(); | 1568 metrics->Stop(); |
| 1560 | 1569 |
| 1561 // browser_shutdown takes care of deleting browser_process, so we need to | 1570 // browser_shutdown takes care of deleting browser_process, so we need to |
| 1562 // release it. | 1571 // release it. |
| 1563 ignore_result(browser_process.release()); | 1572 ignore_result(browser_process.release()); |
| 1564 browser_shutdown::Shutdown(); | 1573 browser_shutdown::Shutdown(); |
| 1565 | 1574 |
| 1566 TRACE_EVENT_END("BrowserMain", 0, 0); | 1575 TRACE_EVENT_END("BrowserMain", 0, 0); |
| 1567 return result_code; | 1576 return result_code; |
| 1568 } | 1577 } |
| OLD | NEW |