OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 #include "chrome/browser/search_engines/search_engine_type.h" | 71 #include "chrome/browser/search_engines/search_engine_type.h" |
72 #include "chrome/browser/search_engines/template_url.h" | 72 #include "chrome/browser/search_engines/template_url.h" |
73 #include "chrome/browser/search_engines/template_url_service.h" | 73 #include "chrome/browser/search_engines/template_url_service.h" |
74 #include "chrome/browser/search_engines/template_url_service_factory.h" | 74 #include "chrome/browser/search_engines/template_url_service_factory.h" |
75 #include "chrome/browser/service/service_process_control.h" | 75 #include "chrome/browser/service/service_process_control.h" |
76 #include "chrome/browser/shell_integration.h" | 76 #include "chrome/browser/shell_integration.h" |
77 #include "chrome/browser/translate/translate_manager.h" | 77 #include "chrome/browser/translate/translate_manager.h" |
78 #include "chrome/browser/ui/browser.h" | 78 #include "chrome/browser/ui/browser.h" |
79 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 79 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
80 #include "chrome/browser/ui/webui/sync_promo_trial.h" | 80 #include "chrome/browser/ui/webui/sync_promo_trial.h" |
81 #include "chrome/browser/web_resource/gpu_blacklist_updater.h" | |
82 #include "chrome/common/child_process_logging.h" | 81 #include "chrome/common/child_process_logging.h" |
83 #include "chrome/common/chrome_constants.h" | 82 #include "chrome/common/chrome_constants.h" |
84 #include "chrome/common/chrome_paths.h" | 83 #include "chrome/common/chrome_paths.h" |
85 #include "chrome/common/chrome_result_codes.h" | 84 #include "chrome/common/chrome_result_codes.h" |
86 #include "chrome/common/chrome_switches.h" | 85 #include "chrome/common/chrome_switches.h" |
87 #include "chrome/common/chrome_version_info.h" | 86 #include "chrome/common/chrome_version_info.h" |
88 #include "chrome/common/env_vars.h" | 87 #include "chrome/common/env_vars.h" |
89 #include "chrome/common/json_pref_store.h" | 88 #include "chrome/common/json_pref_store.h" |
90 #include "chrome/common/jstemplate_builder.h" | 89 #include "chrome/common/jstemplate_builder.h" |
91 #include "chrome/common/logging_chrome.h" | 90 #include "chrome/common/logging_chrome.h" |
92 #include "chrome/common/net/net_resource_provider.h" | 91 #include "chrome/common/net/net_resource_provider.h" |
93 #include "chrome/common/pref_names.h" | 92 #include "chrome/common/pref_names.h" |
94 #include "chrome/common/profiling.h" | 93 #include "chrome/common/profiling.h" |
95 #include "chrome/installer/util/google_update_settings.h" | 94 #include "chrome/installer/util/google_update_settings.h" |
| 95 #include "content/browser/gpu/gpu_blacklist.h" |
| 96 #include "content/browser/gpu/gpu_data_manager.h" |
96 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 97 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
97 #include "content/public/browser/browser_thread.h" | 98 #include "content/public/browser/browser_thread.h" |
98 #include "content/public/common/content_client.h" | 99 #include "content/public/common/content_client.h" |
99 #include "content/public/common/main_function_params.h" | 100 #include "content/public/common/main_function_params.h" |
100 #include "grit/app_locale_settings.h" | 101 #include "grit/app_locale_settings.h" |
| 102 #include "grit/browser_resources.h" |
101 #include "grit/chromium_strings.h" | 103 #include "grit/chromium_strings.h" |
102 #include "grit/generated_resources.h" | 104 #include "grit/generated_resources.h" |
103 #include "grit/platform_locale_settings.h" | 105 #include "grit/platform_locale_settings.h" |
104 #include "net/base/cookie_monster.h" | 106 #include "net/base/cookie_monster.h" |
105 #include "net/base/net_module.h" | 107 #include "net/base/net_module.h" |
106 #include "net/base/sdch_manager.h" | 108 #include "net/base/sdch_manager.h" |
107 #include "net/http/http_basic_stream.h" | 109 #include "net/http/http_basic_stream.h" |
108 #include "net/http/http_network_layer.h" | 110 #include "net/http/http_network_layer.h" |
109 #include "net/http/http_stream_factory.h" | 111 #include "net/http/http_stream_factory.h" |
110 #include "net/socket/client_socket_pool_base.h" | 112 #include "net/socket/client_socket_pool_base.h" |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 #else | 442 #else |
441 // TODO(port): fix this. See comments near the definition of | 443 // TODO(port): fix this. See comments near the definition of |
442 // user_data_dir. It is better to CHECK-fail here than it is to | 444 // user_data_dir. It is better to CHECK-fail here than it is to |
443 // silently exit because of missing code in the above test. | 445 // silently exit because of missing code in the above test. |
444 CHECK(profile) << "Cannot get default profile."; | 446 CHECK(profile) << "Cannot get default profile."; |
445 #endif | 447 #endif |
446 | 448 |
447 return NULL; | 449 return NULL; |
448 } | 450 } |
449 | 451 |
| 452 // Load GPU Blacklist, collect preliminary gpu info, and compute preliminary |
| 453 // gpu feature flags. |
| 454 void InitializeGpuDataManager(const CommandLine& parsed_command_line) { |
| 455 GpuDataManager::GetInstance(); |
| 456 |
| 457 if (parsed_command_line.HasSwitch(switches::kSkipGpuDataLoading)) |
| 458 return; |
| 459 |
| 460 const base::StringPiece gpu_blacklist_json( |
| 461 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 462 IDR_GPU_BLACKLIST)); |
| 463 chrome::VersionInfo version_info; |
| 464 std::string chrome_version_string = |
| 465 version_info.is_valid() ? version_info.Version() : "0"; |
| 466 GpuBlacklist* gpu_blacklist = new GpuBlacklist(chrome_version_string); |
| 467 bool succeed = gpu_blacklist->LoadGpuBlacklist( |
| 468 gpu_blacklist_json.as_string(), GpuBlacklist::kCurrentOsOnly); |
| 469 DCHECK(succeed); |
| 470 GpuDataManager::GetInstance()->SetGpuBlacklist(gpu_blacklist); |
| 471 } |
| 472 |
450 #if defined(OS_CHROMEOS) | 473 #if defined(OS_CHROMEOS) |
451 | 474 |
452 // Class is used to login using passed username and password. | 475 // Class is used to login using passed username and password. |
453 // The instance will be deleted upon success or failure. | 476 // The instance will be deleted upon success or failure. |
454 class StubLogin : public chromeos::LoginStatusConsumer, | 477 class StubLogin : public chromeos::LoginStatusConsumer, |
455 public chromeos::LoginUtils::Delegate { | 478 public chromeos::LoginUtils::Delegate { |
456 public: | 479 public: |
457 StubLogin(std::string username, std::string password) | 480 StubLogin(std::string username, std::string password) |
458 : pending_requests_(false), | 481 : pending_requests_(false), |
459 profile_prepared_(false) { | 482 profile_prepared_(false) { |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1868 g_browser_process->oom_priority_manager()->Start(); | 1891 g_browser_process->oom_priority_manager()->Start(); |
1869 #endif | 1892 #endif |
1870 | 1893 |
1871 // Create the instance of the cloud print proxy service so that it can launch | 1894 // Create the instance of the cloud print proxy service so that it can launch |
1872 // the service process if needed. This is needed because the service process | 1895 // the service process if needed. This is needed because the service process |
1873 // might have shutdown because an update was available. | 1896 // might have shutdown because an update was available. |
1874 // TODO(torne): this should maybe be done with | 1897 // TODO(torne): this should maybe be done with |
1875 // ProfileKeyedServiceFactory::ServiceIsCreatedWithProfile() instead? | 1898 // ProfileKeyedServiceFactory::ServiceIsCreatedWithProfile() instead? |
1876 CloudPrintProxyServiceFactory::GetForProfile(profile_); | 1899 CloudPrintProxyServiceFactory::GetForProfile(profile_); |
1877 | 1900 |
1878 // Initialize GpuDataManager and collect preliminary gpu info. | 1901 // Load GPU Blacklist. |
1879 GpuBlacklistUpdater::Setup(); | 1902 InitializeGpuDataManager(parsed_command_line()); |
1880 | 1903 |
1881 // Start watching all browser threads for responsiveness. | 1904 // Start watching all browser threads for responsiveness. |
1882 ThreadWatcherList::StartWatchingAll(parsed_command_line()); | 1905 ThreadWatcherList::StartWatchingAll(parsed_command_line()); |
1883 | 1906 |
1884 #if !defined(DISABLE_NACL) | 1907 #if !defined(DISABLE_NACL) |
1885 NaClProcessHost::EarlyStartup(); | 1908 NaClProcessHost::EarlyStartup(); |
1886 #endif | 1909 #endif |
1887 | 1910 |
1888 // Instantiate the notification UI manager, as this triggers a perf timer | 1911 // Instantiate the notification UI manager, as this triggers a perf timer |
1889 // used to measure startup time. TODO(stevenjb): Figure out what is actually | 1912 // used to measure startup time. TODO(stevenjb): Figure out what is actually |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2135 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && | 2158 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && |
2136 (pre_read == "0" || pre_read == "1")) { | 2159 (pre_read == "0" || pre_read == "1")) { |
2137 std::string uma_name(name); | 2160 std::string uma_name(name); |
2138 uma_name += "_PreRead"; | 2161 uma_name += "_PreRead"; |
2139 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 2162 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
2140 AddPreReadHistogramTime(uma_name.c_str(), time); | 2163 AddPreReadHistogramTime(uma_name.c_str(), time); |
2141 } | 2164 } |
2142 #endif | 2165 #endif |
2143 #endif | 2166 #endif |
2144 } | 2167 } |
OLD | NEW |