| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "base/threading/platform_thread.h" | 27 #include "base/threading/platform_thread.h" |
| 28 #include "base/time.h" | 28 #include "base/time.h" |
| 29 #include "base/utf_string_conversions.h" | 29 #include "base/utf_string_conversions.h" |
| 30 #include "base/values.h" | 30 #include "base/values.h" |
| 31 #include "build/build_config.h" | 31 #include "build/build_config.h" |
| 32 #include "chrome/browser/about_flags.h" | 32 #include "chrome/browser/about_flags.h" |
| 33 #include "chrome/browser/browser_process.h" | 33 #include "chrome/browser/browser_process.h" |
| 34 #include "chrome/browser/browser_process_impl.h" | 34 #include "chrome/browser/browser_process_impl.h" |
| 35 #include "chrome/browser/browser_shutdown.h" | 35 #include "chrome/browser/browser_shutdown.h" |
| 36 #include "chrome/browser/chrome_browser_main_extra_parts.h" | 36 #include "chrome/browser/chrome_browser_main_extra_parts.h" |
| 37 #include "chrome/browser/chrome_gpu_util.h" | |
| 38 #include "chrome/browser/defaults.h" | 37 #include "chrome/browser/defaults.h" |
| 39 #include "chrome/browser/extensions/extension_protocols.h" | 38 #include "chrome/browser/extensions/extension_protocols.h" |
| 40 #include "chrome/browser/extensions/extension_service.h" | 39 #include "chrome/browser/extensions/extension_service.h" |
| 41 #include "chrome/browser/extensions/startup_helper.h" | 40 #include "chrome/browser/extensions/startup_helper.h" |
| 42 #include "chrome/browser/first_run/upgrade_util.h" | 41 #include "chrome/browser/first_run/upgrade_util.h" |
| 43 #include "chrome/browser/google/google_search_counter.h" | 42 #include "chrome/browser/google/google_search_counter.h" |
| 44 #include "chrome/browser/google/google_util.h" | 43 #include "chrome/browser/google/google_util.h" |
| 44 #include "chrome/browser/gpu_blacklist.h" |
| 45 #include "chrome/browser/jankometer.h" | 45 #include "chrome/browser/jankometer.h" |
| 46 #include "chrome/browser/language_usage_metrics.h" | 46 #include "chrome/browser/language_usage_metrics.h" |
| 47 #include "chrome/browser/managed_mode.h" | 47 #include "chrome/browser/managed_mode.h" |
| 48 #include "chrome/browser/metrics/field_trial_synchronizer.h" | 48 #include "chrome/browser/metrics/field_trial_synchronizer.h" |
| 49 #include "chrome/browser/metrics/metrics_log.h" | 49 #include "chrome/browser/metrics/metrics_log.h" |
| 50 #include "chrome/browser/metrics/metrics_service.h" | 50 #include "chrome/browser/metrics/metrics_service.h" |
| 51 #include "chrome/browser/metrics/thread_watcher.h" | 51 #include "chrome/browser/metrics/thread_watcher.h" |
| 52 #include "chrome/browser/metrics/tracking_synchronizer.h" | 52 #include "chrome/browser/metrics/tracking_synchronizer.h" |
| 53 #include "chrome/browser/metrics/variations/variations_service.h" | 53 #include "chrome/browser/metrics/variations/variations_service.h" |
| 54 #include "chrome/browser/nacl_host/nacl_process_host.h" | 54 #include "chrome/browser/nacl_host/nacl_process_host.h" |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 #else | 417 #else |
| 418 // TODO(port): fix this. See comments near the definition of | 418 // TODO(port): fix this. See comments near the definition of |
| 419 // user_data_dir. It is better to CHECK-fail here than it is to | 419 // user_data_dir. It is better to CHECK-fail here than it is to |
| 420 // silently exit because of missing code in the above test. | 420 // silently exit because of missing code in the above test. |
| 421 CHECK(profile) << "Cannot get default profile."; | 421 CHECK(profile) << "Cannot get default profile."; |
| 422 #endif | 422 #endif |
| 423 | 423 |
| 424 return NULL; | 424 return NULL; |
| 425 } | 425 } |
| 426 | 426 |
| 427 // Load GPU Blacklist, collect preliminary gpu info, and compute preliminary |
| 428 // gpu feature flags. |
| 429 void InitializeGpuDataManager(const CommandLine& parsed_command_line) { |
| 430 content::GpuDataManager::GetInstance()->InitializeGpuInfo(); |
| 431 if (parsed_command_line.HasSwitch(switches::kSkipGpuDataLoading) || |
| 432 parsed_command_line.HasSwitch(switches::kIgnoreGpuBlacklist)) { |
| 433 return; |
| 434 } |
| 435 |
| 436 const base::StringPiece gpu_blacklist_json( |
| 437 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 438 IDR_GPU_BLACKLIST, ui::SCALE_FACTOR_NONE)); |
| 439 GpuBlacklist* gpu_blacklist = GpuBlacklist::GetInstance(); |
| 440 bool succeed = gpu_blacklist->LoadGpuBlacklist( |
| 441 gpu_blacklist_json.as_string(), GpuBlacklist::kCurrentOsOnly); |
| 442 DCHECK(succeed); |
| 443 gpu_blacklist->UpdateGpuDataManager(); |
| 444 } |
| 445 |
| 427 #if defined(OS_MACOSX) | 446 #if defined(OS_MACOSX) |
| 428 OSStatus KeychainCallback(SecKeychainEvent keychain_event, | 447 OSStatus KeychainCallback(SecKeychainEvent keychain_event, |
| 429 SecKeychainCallbackInfo* info, void* context) { | 448 SecKeychainCallbackInfo* info, void* context) { |
| 430 return noErr; | 449 return noErr; |
| 431 } | 450 } |
| 432 #endif | 451 #endif |
| 433 | 452 |
| 434 // This code is specific to the Windows-only PreReadExperiment field-trial. | 453 // This code is specific to the Windows-only PreReadExperiment field-trial. |
| 435 void AddPreReadHistogramTime(const char* name, base::TimeDelta time) { | 454 void AddPreReadHistogramTime(const char* name, base::TimeDelta time) { |
| 436 const base::TimeDelta kMin(base::TimeDelta::FromMilliseconds(1)); | 455 const base::TimeDelta kMin(base::TimeDelta::FromMilliseconds(1)); |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 | 1348 |
| 1330 // Create the instance of the cloud print proxy service so that it can launch | 1349 // Create the instance of the cloud print proxy service so that it can launch |
| 1331 // the service process if needed. This is needed because the service process | 1350 // the service process if needed. This is needed because the service process |
| 1332 // might have shutdown because an update was available. | 1351 // might have shutdown because an update was available. |
| 1333 // TODO(torne): this should maybe be done with | 1352 // TODO(torne): this should maybe be done with |
| 1334 // ProfileKeyedServiceFactory::ServiceIsCreatedWithProfile() instead? | 1353 // ProfileKeyedServiceFactory::ServiceIsCreatedWithProfile() instead? |
| 1335 #if !defined(OS_ANDROID) | 1354 #if !defined(OS_ANDROID) |
| 1336 CloudPrintProxyServiceFactory::GetForProfile(profile_); | 1355 CloudPrintProxyServiceFactory::GetForProfile(profile_); |
| 1337 #endif | 1356 #endif |
| 1338 | 1357 |
| 1339 // Load GPU Blacklist; load preliminary GPU info. | 1358 // Load GPU Blacklist. |
| 1340 gpu_util::InitializeGpuDataManager(parsed_command_line()); | 1359 InitializeGpuDataManager(parsed_command_line()); |
| 1341 | 1360 |
| 1342 // Start watching all browser threads for responsiveness. | 1361 // Start watching all browser threads for responsiveness. |
| 1343 ThreadWatcherList::StartWatchingAll(parsed_command_line()); | 1362 ThreadWatcherList::StartWatchingAll(parsed_command_line()); |
| 1344 | 1363 |
| 1345 #if !defined(DISABLE_NACL) | 1364 #if !defined(DISABLE_NACL) |
| 1346 if (parsed_command_line().HasSwitch(switches::kPnaclDir)) { | 1365 if (parsed_command_line().HasSwitch(switches::kPnaclDir)) { |
| 1347 PathService::Override(chrome::DIR_PNACL_BASE, | 1366 PathService::Override(chrome::DIR_PNACL_BASE, |
| 1348 parsed_command_line().GetSwitchValuePath( | 1367 parsed_command_line().GetSwitchValuePath( |
| 1349 switches::kPnaclDir)); | 1368 switches::kPnaclDir)); |
| 1350 } | 1369 } |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1608 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1627 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 1609 uma_name += "_XP"; | 1628 uma_name += "_XP"; |
| 1610 | 1629 |
| 1611 uma_name += "_PreRead_"; | 1630 uma_name += "_PreRead_"; |
| 1612 uma_name += pre_read_percentage; | 1631 uma_name += pre_read_percentage; |
| 1613 AddPreReadHistogramTime(uma_name.c_str(), time); | 1632 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 1614 } | 1633 } |
| 1615 #endif | 1634 #endif |
| 1616 #endif | 1635 #endif |
| 1617 } | 1636 } |
| OLD | NEW |