Commit 52c83631 authored by Joshua Pawlicki's avatar Joshua Pawlicki Committed by Chromium LUCI CQ

Updater: Create symbolic constant for launchctl timeout.

This standardizes the updater at waiting at most 5 seconds for launchctl to reflect
changes.

Bug: 1151333
Change-Id: I7b15048b44a894b0244eea4fb265f59ee764e7e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2593550
Auto-Submit: Joshua Pawlicki <waffles@chromium.org>
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Reviewed-by: default avatarSorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837113}
parent efd02580
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chrome/updater/constants.h"
#include "chrome/updater/launchd_util.h" #include "chrome/updater/launchd_util.h"
#include "chrome/updater/mac/xpc_service_names.h" #include "chrome/updater/mac/xpc_service_names.h"
...@@ -15,7 +16,7 @@ namespace updater { ...@@ -15,7 +16,7 @@ namespace updater {
void AppInstall::WakeCandidateDone() { void AppInstall::WakeCandidateDone() {
PollLaunchctlList( PollLaunchctlList(
kUpdateServiceLaunchdName, LaunchctlPresence::kPresent, kUpdateServiceLaunchdName, LaunchctlPresence::kPresent,
base::TimeDelta::FromSeconds(5), base::TimeDelta::FromSeconds(kWaitForLaunchctlUpdateSec),
base::BindOnce([](scoped_refptr<AppInstall> installer, base::BindOnce([](scoped_refptr<AppInstall> installer,
bool unused) { installer->RegisterUpdater(); }, bool unused) { installer->RegisterUpdater(); },
base::WrapRefCounted(this))); base::WrapRefCounted(this)));
......
...@@ -139,9 +139,8 @@ extern const char kUninstallScript[]; ...@@ -139,9 +139,8 @@ extern const char kUninstallScript[];
extern const char kDevOverrideKeyUrl[]; extern const char kDevOverrideKeyUrl[];
extern const char kDevOverrideKeyUseCUP[]; extern const char kDevOverrideKeyUseCUP[];
#if defined(OS_WIN)
// Timing constants. // Timing constants.
// #if defined(OS_WIN)
// How long to wait for an application installer (such as // How long to wait for an application installer (such as
// chrome_installer.exe) to complete. // chrome_installer.exe) to complete.
constexpr int kWaitForAppInstallerSec = 60; constexpr int kWaitForAppInstallerSec = 60;
...@@ -149,7 +148,10 @@ constexpr int kWaitForAppInstallerSec = 60; ...@@ -149,7 +148,10 @@ constexpr int kWaitForAppInstallerSec = 60;
// How often the installer progress from registry is sampled. This value may // How often the installer progress from registry is sampled. This value may
// be changed to provide a smoother progress experience (crbug.com/1067475). // be changed to provide a smoother progress experience (crbug.com/1067475).
constexpr int kWaitForInstallerProgressSec = 1; constexpr int kWaitForInstallerProgressSec = 1;
#endif // OS_WIN #elif defined(OS_MAC)
// How long to wait for launchd changes to be reported by launchctl.
constexpr int kWaitForLaunchctlUpdateSec = 5;
#endif // defined(OS_MAC)
// Install Errors. // Install Errors.
// //
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/task/task_traits.h" #include "base/task/task_traits.h"
#include "base/task/thread_pool.h" #include "base/task/thread_pool.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chrome/updater/constants.h"
#include "chrome/updater/launchd_util.h" #include "chrome/updater/launchd_util.h"
#include "chrome/updater/mac/xpc_service_names.h" #include "chrome/updater/mac/xpc_service_names.h"
...@@ -24,7 +25,7 @@ void SetupDone(base::OnceCallback<void(int)> callback, int result) { ...@@ -24,7 +25,7 @@ void SetupDone(base::OnceCallback<void(int)> callback, int result) {
} }
PollLaunchctlList( PollLaunchctlList(
kUpdateServiceInternalLaunchdName, LaunchctlPresence::kPresent, kUpdateServiceInternalLaunchdName, LaunchctlPresence::kPresent,
base::TimeDelta::FromSeconds(3), base::TimeDelta::FromSeconds(kWaitForLaunchctlUpdateSec),
base::BindOnce( base::BindOnce(
[](base::OnceCallback<void(int)> callback, bool service_exists) { [](base::OnceCallback<void(int)> callback, bool service_exists) {
std::move(callback).Run( std::move(callback).Run(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment