Commit b119a833 authored by Joshua Pawlicki's avatar Joshua Pawlicki Committed by Commit Bot

Updater: during installation on mac, wait for service availability.

This prevents the --install process from exiting before the global
service is actually available. Additionally, since we are going to call
UpdateService to update the app registration anyways, this is the
appropriate time to wait until its there.

Bug: 1131654
Change-Id: Ifff75fafdf71a46877e9918bc26a40961703b86d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2441283
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Reviewed-by: default avatarSorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813275}
parent e2398c2c
......@@ -119,6 +119,7 @@ if (is_win || is_mac) {
if (is_mac) {
sources += [
"app/app_install_mac.mm",
"app/server/mac/app_server.h",
"app/server/mac/server.h",
"app/server/mac/server.mm",
......@@ -144,6 +145,7 @@ if (is_win || is_mac) {
if (is_win) {
sources += [
"app/app_install_win.cc",
"app/server/win/com_classes.cc",
"app/server/win/com_classes.h",
"app/server/win/com_classes_legacy.cc",
......
......@@ -108,7 +108,10 @@ void AppInstall::InstallCandidateDone(int result) {
Shutdown(result);
return;
}
WakeCandidate();
}
void AppInstall::WakeCandidate() {
// Invoke ControlService::InitializeUpdateService to wake this version of the
// updater, qualify, and possibly promote this version as a result. The
// instance of |CreateControlService| has sequence affinity. Bind it in the
......@@ -117,7 +120,7 @@ void AppInstall::InstallCandidateDone(int result) {
control_service->InitializeUpdateService(base::BindOnce(
[](scoped_refptr<ControlService> /*control_service*/,
scoped_refptr<AppInstall> app_install) {
app_install->RegisterUpdater();
app_install->WakeCandidateDone();
},
control_service, base::WrapRefCounted(this)));
}
......
......@@ -56,6 +56,10 @@ class AppInstall : public App {
void InstallCandidateDone(int result);
void WakeCandidate();
void WakeCandidateDone();
void RegisterUpdater();
void RegisterUpdaterDone(const RegistrationResponse& response);
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/updater/app/app_install.h"
#include "base/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/time/time.h"
#include "chrome/updater/launchd_util.h"
#include "chrome/updater/mac/xpc_service_names.h"
namespace updater {
void AppInstall::WakeCandidateDone() {
PollLaunchctlList(
kUpdateLaunchdName, base::TimeDelta::FromSeconds(5),
base::BindOnce([](scoped_refptr<AppInstall> installer,
bool unused) { installer->RegisterUpdater(); },
base::WrapRefCounted(this)));
}
} // namespace updater
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/updater/app/app_install.h"
namespace updater {
void AppInstall::WakeCandidateDone() {
RegisterUpdater();
}
} // namespace updater
......@@ -11,6 +11,7 @@
namespace updater {
extern const char kControlLaunchdName[];
extern const char kUpdateLaunchdName[];
base::ScopedCFTypeRef<CFStringRef> CopyServiceLaunchdName();
base::ScopedCFTypeRef<CFStringRef> CopyWakeLaunchdName();
......
......@@ -14,9 +14,10 @@ namespace updater {
const char kControlLaunchdName[] =
MAC_BUNDLE_IDENTIFIER_STRING ".control." UPDATER_VERSION_STRING;
const char kUpdateLaunchdName[] = MAC_BUNDLE_IDENTIFIER_STRING ".service";
base::ScopedCFTypeRef<CFStringRef> CopyServiceLaunchdName() {
return base::SysUTF8ToCFStringRef(MAC_BUNDLE_IDENTIFIER_STRING ".service");
return base::SysUTF8ToCFStringRef(kUpdateLaunchdName);
}
base::ScopedCFTypeRef<CFStringRef> CopyWakeLaunchdName() {
......
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