Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1125 // metrics and initialize field trials. The field trials are needed by | 1125 // metrics and initialize field trials. The field trials are needed by |
| 1126 // IOThread's initialization which happens in BrowserProcess:PreCreateThreads. | 1126 // IOThread's initialization which happens in BrowserProcess:PreCreateThreads. |
| 1127 SetupMetricsAndFieldTrials(); | 1127 SetupMetricsAndFieldTrials(); |
| 1128 | 1128 |
| 1129 // ChromeOS needs ResourceBundle::InitSharedInstance to be called before this. | 1129 // ChromeOS needs ResourceBundle::InitSharedInstance to be called before this. |
| 1130 browser_process_->PreCreateThreads(); | 1130 browser_process_->PreCreateThreads(); |
| 1131 | 1131 |
| 1132 return content::RESULT_CODE_NORMAL_EXIT; | 1132 return content::RESULT_CODE_NORMAL_EXIT; |
| 1133 } | 1133 } |
| 1134 | 1134 |
| 1135 void ChromeBrowserMainParts::PreCreateThreadsEnd() { | |
| 1136 // GpuDataManagerImpl::GetInstance()->Initialize(); is called at the end of | |
| 1137 // BrowserMainLoop::PreCreateThreads() so it is wrong to call the 2 following | |
| 1138 // function in this->PreCreateThreads(). Otherwise it will access the gpu | |
| 1139 // data manager before initializing it. | |
| 1140 // Alternatively we could ensure that content::GpuDataManager::GetInstance() | |
|
Zhenyao Mo
2016/01/05 18:04:44
No, we want to be explicit where and when Initiali
| |
| 1141 // internally calls GpuDataManagerImpl::GetInstance()->Initialize(). | |
| 1142 | |
| 1143 // Retrieve cached GL strings from local state and use them for GPU | |
| 1144 // blacklist decisions. | |
| 1145 if (g_browser_process->gl_string_manager()) | |
| 1146 g_browser_process->gl_string_manager()->Initialize(); | |
| 1147 | |
| 1148 // Create an instance of GpuModeManager to watch gpu mode pref change. | |
| 1149 g_browser_process->gpu_mode_manager(); | |
| 1150 } | |
| 1151 | |
| 1135 void ChromeBrowserMainParts::PreMainMessageLoopRun() { | 1152 void ChromeBrowserMainParts::PreMainMessageLoopRun() { |
| 1136 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRun"); | 1153 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRun"); |
| 1137 TRACK_SCOPED_REGION( | 1154 TRACK_SCOPED_REGION( |
| 1138 "Startup", "ChromeBrowserMainParts::PreMainMessageLoopRun"); | 1155 "Startup", "ChromeBrowserMainParts::PreMainMessageLoopRun"); |
| 1139 | 1156 |
| 1140 result_code_ = PreMainMessageLoopRunImpl(); | 1157 result_code_ = PreMainMessageLoopRunImpl(); |
| 1141 | 1158 |
| 1142 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1159 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 1143 chrome_extra_parts_[i]->PreMainMessageLoopRun(); | 1160 chrome_extra_parts_[i]->PreMainMessageLoopRun(); |
| 1144 } | 1161 } |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1495 #if !defined(DISABLE_NACL) | 1512 #if !defined(DISABLE_NACL) |
| 1496 NaClBrowserDelegateImpl* delegate = | 1513 NaClBrowserDelegateImpl* delegate = |
| 1497 new NaClBrowserDelegateImpl(browser_process_->profile_manager()); | 1514 new NaClBrowserDelegateImpl(browser_process_->profile_manager()); |
| 1498 nacl::NaClBrowser::SetDelegate(delegate); | 1515 nacl::NaClBrowser::SetDelegate(delegate); |
| 1499 #endif // !defined(DISABLE_NACL) | 1516 #endif // !defined(DISABLE_NACL) |
| 1500 | 1517 |
| 1501 // TODO(stevenjb): Move WIN and MACOSX specific code to appropriate Parts. | 1518 // TODO(stevenjb): Move WIN and MACOSX specific code to appropriate Parts. |
| 1502 // (requires supporting early exit). | 1519 // (requires supporting early exit). |
| 1503 PostProfileInit(); | 1520 PostProfileInit(); |
| 1504 | 1521 |
| 1505 // Retrieve cached GL strings from local state and use them for GPU | |
| 1506 // blacklist decisions. | |
| 1507 if (g_browser_process->gl_string_manager()) | |
| 1508 g_browser_process->gl_string_manager()->Initialize(); | |
| 1509 | |
| 1510 // Create an instance of GpuModeManager to watch gpu mode pref change. | |
| 1511 g_browser_process->gpu_mode_manager(); | |
| 1512 | |
| 1513 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | 1522 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
| 1514 // Show the First Run UI if this is the first time Chrome has been run on | 1523 // Show the First Run UI if this is the first time Chrome has been run on |
| 1515 // this computer, or we're being compelled to do so by a command line flag. | 1524 // this computer, or we're being compelled to do so by a command line flag. |
| 1516 // Note that this be done _after_ the PrefService is initialized and all | 1525 // Note that this be done _after_ the PrefService is initialized and all |
| 1517 // preferences are registered, since some of the code that the importer | 1526 // preferences are registered, since some of the code that the importer |
| 1518 // touches reads preferences. | 1527 // touches reads preferences. |
| 1519 // TODO(bshe): Figure out which first run code to use for Aura Android. See | 1528 // TODO(bshe): Figure out which first run code to use for Aura Android. See |
| 1520 // crbug.com/560498 | 1529 // crbug.com/560498 |
| 1521 if (first_run::IsChromeFirstRun()) { | 1530 if (first_run::IsChromeFirstRun()) { |
| 1522 first_run::AutoImport(profile_, | 1531 first_run::AutoImport(profile_, |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1910 chromeos::CrosSettings::Shutdown(); | 1919 chromeos::CrosSettings::Shutdown(); |
| 1911 #endif // defined(OS_CHROMEOS) | 1920 #endif // defined(OS_CHROMEOS) |
| 1912 #endif // defined(OS_ANDROID) | 1921 #endif // defined(OS_ANDROID) |
| 1913 } | 1922 } |
| 1914 | 1923 |
| 1915 // Public members: | 1924 // Public members: |
| 1916 | 1925 |
| 1917 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1926 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 1918 chrome_extra_parts_.push_back(parts); | 1927 chrome_extra_parts_.push_back(parts); |
| 1919 } | 1928 } |
| OLD | NEW |