Commit cfa53fe5 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Remove static initializers in dlcservice_client.cc.

Do not re-invent base::DoNothing() poorly.

Bug: 537099
Change-Id: I837c8995686d1fa87779b58ab621d0e712803864
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2430824
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811510}
parent 95f352eb
......@@ -350,7 +350,7 @@ void PluginVmManagerImpl::InstallDlcAndUpdateVmState(
base::BindOnce(&PluginVmManagerImpl::OnInstallPluginVmDlc,
weak_ptr_factory_.GetWeakPtr(),
std::move(success_callback), std::move(error_callback)),
chromeos::DlcserviceClient::IgnoreProgress);
base::DoNothing());
}
void PluginVmManagerImpl::OnInstallPluginVmDlc(
......
......@@ -427,9 +427,6 @@ class DlcserviceClientImpl : public DlcserviceClient {
DISALLOW_COPY_AND_ASSIGN(DlcserviceClientImpl);
};
const DlcserviceClient::ProgressCallback DlcserviceClient::IgnoreProgress =
base::BindRepeating([](double) {});
DlcserviceClient::DlcserviceClient() {
CHECK(!g_instance);
g_instance = this;
......
......@@ -83,10 +83,6 @@ class COMPONENT_EXPORT(DLCSERVICE_CLIENT) DlcserviceClient {
const std::string& err,
const dlcservice::DlcsWithContent& dlcs_with_content)>;
// The callback to use for |Install()|, if the caller wants to ignore the
// progress updates.
static const ProgressCallback IgnoreProgress;
// Installs the DLC passed in while reporting progress through the progress
// callback and only calls install callback on install success/failure.
virtual void Install(const std::string& dlc_id,
......
......@@ -12,6 +12,7 @@
#include <vector>
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "dbus/mock_bus.h"
......@@ -282,8 +283,7 @@ TEST_F(DlcserviceClientTest, InstallSuccessTest) {
base::BindOnce([](const DlcserviceClient::InstallResult& install_result) {
EXPECT_EQ(dlcservice::kErrorNone, install_result.error);
});
client_->Install("foo-dlc", std::move(install_callback),
DlcserviceClient::IgnoreProgress);
client_->Install("foo-dlc", std::move(install_callback), base::DoNothing());
base::RunLoop().RunUntilIdle();
}
......@@ -302,8 +302,7 @@ TEST_F(DlcserviceClientTest, InstallFailureTest) {
base::BindOnce([](const DlcserviceClient::InstallResult& install_result) {
EXPECT_EQ(dlcservice::kErrorInternal, install_result.error);
});
client_->Install("foo-dlc", std::move(install_callback),
DlcserviceClient::IgnoreProgress);
client_->Install("foo-dlc", std::move(install_callback), base::DoNothing());
base::RunLoop().RunUntilIdle();
}
......@@ -373,8 +372,7 @@ TEST_F(DlcserviceClientTest, InstallBusyStatusTest) {
base::BindOnce([](const DlcserviceClient::InstallResult& install_result) {
EXPECT_EQ(dlcservice::kErrorNone, install_result.error);
});
client_->Install("foo-dlc", std::move(install_callback),
DlcserviceClient::IgnoreProgress);
client_->Install("foo-dlc", std::move(install_callback), base::DoNothing());
base::RunLoop().RunUntilIdle();
}
......@@ -395,8 +393,7 @@ TEST_F(DlcserviceClientTest, PendingTaskTest) {
},
&counter);
responses_.push_back(dbus::Response::CreateEmpty());
client_->Install({}, std::move(install_callback),
DlcserviceClient::IgnoreProgress);
client_->Install({}, std::move(install_callback), base::DoNothing());
}
base::RunLoop().RunUntilIdle();
EXPECT_EQ(0u, counter.load());
......
......@@ -7,6 +7,7 @@
#include <string>
#include <utility>
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/metrics/histogram_macros.h"
#include "chromeos/services/machine_learning/public/cpp/service_connection.h"
......@@ -93,7 +94,7 @@ void OnGetExistingDlcsComplete(
kLibHandwritingDlcId,
base::BindOnce(&OnInstallDlcComplete, std::move(spec),
std::move(receiver), std::move(callback)),
chromeos::DlcserviceClient::IgnoreProgress);
base::DoNothing());
return;
}
}
......
......@@ -36,7 +36,6 @@ _CROS_SI_FILE_ALLOWLIST = {
'debugallocation_shim.cc', # TODO(crbug.com/973552): Remove.
'iostream.cpp', # TODO(crbug.com/973554): Remove.
'spinlock.cc', # TODO(crbug.com/973556): Remove.
'dlcservice_client.cc', # TODO(crbug.com/537099): Remove.
'hud_display.cc', # TODO(crbug.com/537099): Remove.
'int256.cc', # TODO(crbug.com/537099): Remove.
'native_message_host_chromeos.cc', # TODO(crbug.com/537099): Remove.
......
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