-
Notifications
You must be signed in to change notification settings - Fork 869
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support OnDemandUpdate with multiple components at once. (#23169)
* Support OnDemandUpdate with multiple components at once. * Review fixes. * Mark two missed components as Brave.
- Loading branch information
Showing
32 changed files
with
362 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
chromium_src/components/component_updater/component_updater_service.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* Copyright (c) 2024 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "components/component_updater/component_updater_service.h" | ||
|
||
#include "base/notreached.h" | ||
#include "components/component_updater/component_updater_service_internal.h" | ||
|
||
#include "src/components/component_updater/component_updater_service.cc" | ||
|
||
namespace component_updater { | ||
|
||
void CrxUpdateService::OnDemandUpdate(const std::vector<std::string>& ids, | ||
Priority priority, | ||
Callback callback) { | ||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | ||
|
||
for (const auto& id : ids) { | ||
if (!GetComponent(id)) { | ||
if (callback) { | ||
base::SequencedTaskRunner::GetCurrentDefault()->PostTask( | ||
FROM_HERE, base::BindOnce(std::move(callback), | ||
update_client::Error::INVALID_ARGUMENT)); | ||
} | ||
return; | ||
} | ||
} | ||
|
||
auto crx_data_callback = base::BindOnce(&CrxUpdateService::GetCrxComponents, | ||
base::Unretained(this)); | ||
auto update_complete_callback = base::BindOnce( | ||
&CrxUpdateService::OnUpdateComplete, base::Unretained(this), | ||
std::move(callback), base::TimeTicks::Now()); | ||
|
||
update_client_->Update(ids, std::move(crx_data_callback), {}, | ||
priority == Priority::FOREGROUND, | ||
std::move(update_complete_callback)); | ||
} | ||
|
||
void OnDemandUpdater::OnDemandUpdate(const std::vector<std::string>& ids, | ||
Priority priority, | ||
Callback callback) { | ||
NOTREACHED_NORETURN(); | ||
} | ||
|
||
} // namespace component_updater |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
chromium_src/components/component_updater/component_updater_service_internal.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* Copyright (c) 2024 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_INTERNAL_H_ | ||
#define BRAVE_CHROMIUM_SRC_COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_INTERNAL_H_ | ||
|
||
#include "components/component_updater/component_updater_service.h" | ||
|
||
#define OnDemandUpdate \ | ||
OnDemandUpdate(const std::vector<std::string>& ids, Priority priority, \ | ||
Callback callback) override; \ | ||
void OnDemandUpdate | ||
|
||
#include "src/components/component_updater/component_updater_service_internal.h" // IWYU pragma: export | ||
|
||
#undef OnDemandUpdate | ||
|
||
#endif // BRAVE_CHROMIUM_SRC_COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_INTERNAL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.