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/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 PrefService* local_state = browser_process->local_state(); | 403 PrefService* local_state = browser_process->local_state(); |
404 DCHECK(local_state); | 404 DCHECK(local_state); |
405 | 405 |
406 // Initialize ResourceBundle which handles files loaded from external | 406 // Initialize ResourceBundle which handles files loaded from external |
407 // sources. This has to be done before uninstall code path and before prefs | 407 // sources. This has to be done before uninstall code path and before prefs |
408 // are registered. | 408 // are registered. |
409 local_state->RegisterStringPref(prefs::kApplicationLocale, L""); | 409 local_state->RegisterStringPref(prefs::kApplicationLocale, L""); |
410 local_state->RegisterBooleanPref(prefs::kMetricsReportingEnabled, | 410 local_state->RegisterBooleanPref(prefs::kMetricsReportingEnabled, |
411 GoogleUpdateSettings::GetCollectStatsConsent()); | 411 GoogleUpdateSettings::GetCollectStatsConsent()); |
412 | 412 |
413 // Start the database thread (the order of when this happens in this function | |
414 // doesn't matter, all we need is to kick it off). | |
415 browser_process->db_thread(); | |
416 | |
417 #if defined(TOOLKIT_GTK) | 413 #if defined(TOOLKIT_GTK) |
418 // It is important for this to happen before the first run dialog, as it | 414 // It is important for this to happen before the first run dialog, as it |
419 // styles the dialog as well. | 415 // styles the dialog as well. |
420 gtk_util::InitRCStyles(); | 416 gtk_util::InitRCStyles(); |
421 #elif defined(TOOLKIT_VIEWS) | 417 #elif defined(TOOLKIT_VIEWS) |
422 // The delegate needs to be set before any UI is created so that windows | 418 // The delegate needs to be set before any UI is created so that windows |
423 // display the correct icon. | 419 // display the correct icon. |
424 if (!views::ViewsDelegate::views_delegate) | 420 if (!views::ViewsDelegate::views_delegate) |
425 views::ViewsDelegate::views_delegate = new ChromeViewsDelegate; | 421 views::ViewsDelegate::views_delegate = new ChromeViewsDelegate; |
426 #endif | 422 #endif |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 // Sets things up so that if we crash from this point on, a dialog will | 707 // Sets things up so that if we crash from this point on, a dialog will |
712 // popup asking the user to restart chrome. It is done this late to avoid | 708 // popup asking the user to restart chrome. It is done this late to avoid |
713 // testing against a bunch of special cases that are taken care early on. | 709 // testing against a bunch of special cases that are taken care early on. |
714 PrepareRestartOnCrashEnviroment(parsed_command_line); | 710 PrepareRestartOnCrashEnviroment(parsed_command_line); |
715 | 711 |
716 #if defined(OS_WIN) | 712 #if defined(OS_WIN) |
717 // Initialize Winsock. | 713 // Initialize Winsock. |
718 net::EnsureWinsockInit(); | 714 net::EnsureWinsockInit(); |
719 #endif // defined(OS_WIN) | 715 #endif // defined(OS_WIN) |
720 | 716 |
| 717 // Create the child threads. We need to do this since ChromeThread::PostTask |
| 718 // silently deletes a posted task if the target message loop isn't created. |
| 719 browser_process->db_thread(); |
| 720 browser_process->file_thread(); |
| 721 browser_process->io_thread(); |
| 722 |
721 // Initialize and maintain DNS prefetcher module. | 723 // Initialize and maintain DNS prefetcher module. |
722 chrome_browser_net::DnsPrefetcherInit dns_prefetch(user_prefs, local_state); | 724 chrome_browser_net::DnsPrefetcherInit dns_prefetch(user_prefs, local_state); |
723 | 725 |
724 scoped_refptr<FieldTrial> http_prioritization_trial = | 726 scoped_refptr<FieldTrial> http_prioritization_trial = |
725 new FieldTrial("HttpPrioritization", 100); | 727 new FieldTrial("HttpPrioritization", 100); |
726 // Put 10% of people in the fallback experiment with the http prioritization | 728 // Put 10% of people in the fallback experiment with the http prioritization |
727 // code disabled. | 729 // code disabled. |
728 const int holdback_group = | 730 const int holdback_group = |
729 http_prioritization_trial->AppendGroup("_no_http_prioritization", 10); | 731 http_prioritization_trial->AppendGroup("_no_http_prioritization", 10); |
730 if (http_prioritization_trial->group() == holdback_group) { | 732 if (http_prioritization_trial->group() == holdback_group) { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 if (metrics) | 897 if (metrics) |
896 metrics->Stop(); | 898 metrics->Stop(); |
897 | 899 |
898 // 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 |
899 // release it. | 901 // release it. |
900 browser_process.release(); | 902 browser_process.release(); |
901 browser_shutdown::Shutdown(); | 903 browser_shutdown::Shutdown(); |
902 | 904 |
903 return result_code; | 905 return result_code; |
904 } | 906 } |
OLD | NEW |