Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/installer/setup/setup_main.cc

Issue 1475643004: Add crash keys for the installer covering simple InstallerState fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add previous version, plus some comments Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/installer/setup/setup_main.h" 5 #include "chrome/installer/setup/setup_main.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <msi.h> 8 #include <msi.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 1327
1328 scoped_ptr<metrics::ClientInfo> client_info = 1328 scoped_ptr<metrics::ClientInfo> client_info =
1329 GoogleUpdateSettings::LoadMetricsClientInfo(); 1329 GoogleUpdateSettings::LoadMetricsClientInfo();
1330 if (client_info) 1330 if (client_info)
1331 crash_client->SetCrashReporterClientIdFromGUID(client_info->client_id); 1331 crash_client->SetCrashReporterClientIdFromGUID(client_info->client_id);
1332 // TODO(grt): A lack of a client_id at this point generally means that Chrome 1332 // TODO(grt): A lack of a client_id at this point generally means that Chrome
1333 // has yet to have been launched and picked one. Consider creating it and 1333 // has yet to have been launched and picked one. Consider creating it and
1334 // setting it here for Chrome to use. 1334 // setting it here for Chrome to use.
1335 } 1335 }
1336 1336
1337 void SetStartingCrashKeys(const InstallerState& installer_state,
grt (UTC plus 2) 2015/11/25 16:44:09 wdyt of moving this and the impl of InstallerCrash
Joe Mason 2015/11/25 17:16:34 Good idea. It will help with the more invasive key
1338 const InstallationState& original_state)
1339 {
1340 scoped_ptr<base::Version> current_version(
grt (UTC plus 2) 2015/11/25 16:44:09 CheckPreInstallConditions mutates |installer_state
Joe Mason 2015/11/25 20:12:52 installer_state is also mutated by HandleNonInstal
grt (UTC plus 2) 2015/11/25 20:34:30 I think it would be fine to set this crash key wit
1341 installer_state.GetCurrentVersion(original_state));
1342 if (current_version) {
1343 base::debug::SetCrashKeyValue(installer::crash_keys::kCurrentVersion,
1344 current_version->GetString());
1345 }
1346
1347 switch (installer_state.state_type()) {
grt (UTC plus 2) 2015/11/25 16:44:09 i think this is cleaner like so: const char* Dist
Joe Mason 2015/11/25 17:16:34 What do you think of making this a BrowserDistribu
grt (UTC plus 2) 2015/11/25 17:44:01 I think of this mapping being specific to the cras
1348 case BrowserDistribution::CHROME_BROWSER:
1349 base::debug::SetCrashKeyValue(installer::crash_keys::kDistributionType,
1350 "browser");
1351 break;
1352 case BrowserDistribution::CHROME_FRAME:
1353 base::debug::SetCrashKeyValue(installer::crash_keys::kDistributionType,
1354 "frame");
1355 break;
1356 case BrowserDistribution::CHROME_BINARIES:
1357 base::debug::SetCrashKeyValue(installer::crash_keys::kDistributionType,
1358 "binaries");
1359 break;
1360 case BrowserDistribution::NUM_TYPES:
1361 // Not a real enum value.
1362 assert(false);
grt (UTC plus 2) 2015/11/25 16:44:09 use NOTREACHED() (to crash debug builds) or CHECK(
1363 break;
1364 }
1365
1366 switch (installer_state.operation()) {
1367 case InstallerState::SINGLE_INSTALL_OR_UPDATE:
1368 base::debug::SetCrashKeyValue(installer::crash_keys::kOperation,
1369 "single-install-or-update");
1370 break;
1371 case InstallerState::MULTI_INSTALL:
1372 base::debug::SetCrashKeyValue(installer::crash_keys::kOperation,
1373 "multi-install");
1374 break;
1375 case InstallerState::MULTI_UPDATE:
1376 base::debug::SetCrashKeyValue(installer::crash_keys::kOperation,
1377 "multi-update");
1378 break;
1379 case InstallerState::UNINSTALL:
1380 base::debug::SetCrashKeyValue(installer::crash_keys::kOperation,
1381 "uninstall");
1382 break;
1383 case InstallerState::UNINITIALIZED:
1384 // Do nothing.
1385 break;
1386 }
1387
1388 switch (installer_state.package_type()) {
1389 case InstallerState::SINGLE_PACKAGE:
1390 base::debug::SetCrashKeyValue(installer::crash_keys::kPackageType,
1391 "single");
1392 break;
1393 case InstallerState::MULTI_PACKAGE:
1394 base::debug::SetCrashKeyValue(installer::crash_keys::kPackageType,
1395 "multi");
1396 break;
1397 case InstallerState::UNKNOWN_PACKAGE_TYPE:
1398 // Do nothing.
1399 break;
1400 }
1401
1402 switch (installer_state.level()) {
1403 case InstallerState::USER_LEVEL:
1404 base::debug::SetCrashKeyValue(installer::crash_keys::kPrivilegeLevel,
1405 "user");
1406 break;
1407 case InstallerState::SYSTEM_LEVEL:
1408 base::debug::SetCrashKeyValue(installer::crash_keys::kPrivilegeLevel,
1409 "system");
1410 break;
1411 case InstallerState::UNKNOWN_LEVEL:
1412 // Do nothing.
1413 break;
1414 }
1415
1416 const std::wstring state_key = installer_state.state_key();
1417 if (!state_key.empty()) {
1418 base::debug::SetCrashKeyValue(installer::crash_keys::kStateKey,
1419 base::UTF16ToUTF8(state_key));
1420 }
1421 }
1422
1337 // Uninstalls multi-install Chrome Frame if the current operation is a 1423 // Uninstalls multi-install Chrome Frame if the current operation is a
1338 // multi-install install or update. The operation is performed directly rather 1424 // multi-install install or update. The operation is performed directly rather
1339 // than delegated to the existing install since there is no facility in older 1425 // than delegated to the existing install since there is no facility in older
1340 // versions of setup.exe to uninstall GCF without touching the binaries. The 1426 // versions of setup.exe to uninstall GCF without touching the binaries. The
1341 // binaries will be uninstalled during later processing if they are not in-use 1427 // binaries will be uninstalled during later processing if they are not in-use
1342 // (see UninstallBinariesIfUnused). |original_state| and |installer_state| are 1428 // (see UninstallBinariesIfUnused). |original_state| and |installer_state| are
1343 // updated to reflect the state of the world following the operation. 1429 // updated to reflect the state of the world following the operation.
1344 void UninstallMultiChromeFrameIfPresent(const base::CommandLine& cmd_line, 1430 void UninstallMultiChromeFrameIfPresent(const base::CommandLine& cmd_line,
1345 const MasterPreferences& prefs, 1431 const MasterPreferences& prefs,
1346 InstallationState* original_state, 1432 InstallationState* original_state,
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); 1784 prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install);
1699 VLOG(1) << "system install is " << system_install; 1785 VLOG(1) << "system install is " << system_install;
1700 1786
1701 InstallationState original_state; 1787 InstallationState original_state;
1702 original_state.Initialize(); 1788 original_state.Initialize();
1703 1789
1704 InstallerState installer_state; 1790 InstallerState installer_state;
1705 installer_state.Initialize(cmd_line, prefs, original_state); 1791 installer_state.Initialize(cmd_line, prefs, original_state);
1706 1792
1707 ConfigureCrashReporting(installer_state); 1793 ConfigureCrashReporting(installer_state);
1794 SetStartingCrashKeys(installer_state, original_state);
1708 1795
1709 // Make sure the process exits cleanly on unexpected errors. 1796 // Make sure the process exits cleanly on unexpected errors.
1710 base::EnableTerminationOnHeapCorruption(); 1797 base::EnableTerminationOnHeapCorruption();
1711 base::EnableTerminationOnOutOfMemory(); 1798 base::EnableTerminationOnOutOfMemory();
1712 base::win::RegisterInvalidParamHandler(); 1799 base::win::RegisterInvalidParamHandler();
1713 base::win::SetupCRT(cmd_line); 1800 base::win::SetupCRT(cmd_line);
1714 1801
1715 const bool is_uninstall = cmd_line.HasSwitch(installer::switches::kUninstall); 1802 const bool is_uninstall = cmd_line.HasSwitch(installer::switches::kUninstall);
1716 1803
1717 // Check to make sure current system is WinXP or later. If not, log 1804 // Check to make sure current system is WinXP or later. If not, log
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1824 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT 1911 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT
1825 // to pass through, since this is only returned on uninstall which is 1912 // to pass through, since this is only returned on uninstall which is
1826 // never invoked directly by Google Update. 1913 // never invoked directly by Google Update.
1827 return_code = InstallUtil::GetInstallReturnCode(install_status); 1914 return_code = InstallUtil::GetInstallReturnCode(install_status);
1828 } 1915 }
1829 1916
1830 VLOG(1) << "Installation complete, returning: " << return_code; 1917 VLOG(1) << "Installation complete, returning: " << return_code;
1831 1918
1832 return return_code; 1919 return return_code;
1833 } 1920 }
OLDNEW
« chrome/installer/setup/setup_constants.cc ('K') | « chrome/installer/setup/setup_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698