chore: fix clang-tidy warnings (#38079)

* chore: fix clang-tidy warnings

* refactor: avoid need for NOLINTNEXTLINE
This commit is contained in:
David Sanders 2023-04-26 07:09:54 -07:00 committed by GitHub
parent fe5cdd39d6
commit 08593fd2bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 41 additions and 37 deletions

View file

@ -243,8 +243,8 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
std::vector<DesktopCapturer::Source> window_sources;
window_sources.reserve(list->GetSourceCount());
for (int i = 0; i < list->GetSourceCount(); i++) {
window_sources.emplace_back(DesktopCapturer::Source{
list->GetSource(i), std::string(), fetch_window_icons_});
window_sources.emplace_back(list->GetSource(i), std::string(),
fetch_window_icons_);
}
std::move(window_sources.begin(), window_sources.end(),
std::back_inserter(captured_sources_));
@ -256,8 +256,7 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
std::vector<DesktopCapturer::Source> screen_sources;
screen_sources.reserve(list->GetSourceCount());
for (int i = 0; i < list->GetSourceCount(); i++) {
screen_sources.emplace_back(
DesktopCapturer::Source{list->GetSource(i), std::string()});
screen_sources.emplace_back(list->GetSource(i), std::string());
}
#if BUILDFLAG(IS_WIN)
// Gather the same unique screen IDs used by the electron.screen API in

View file

@ -17,17 +17,21 @@ namespace electron::api {
gin::WrapperInfo SystemPreferences::kWrapperInfo = {gin::kEmbedderNativeGin};
#if BUILDFLAG(IS_WIN)
SystemPreferences::SystemPreferences() {
#if BUILDFLAG(IS_WIN)
InitializeWindow();
#endif
}
#else
SystemPreferences::SystemPreferences() = default;
#endif
SystemPreferences::~SystemPreferences() {
#if BUILDFLAG(IS_WIN)
SystemPreferences::~SystemPreferences() {
Browser::Get()->RemoveObserver(this);
#endif
}
#else
SystemPreferences::~SystemPreferences() = default;
#endif
bool SystemPreferences::IsInvertedColorScheme() {
return ui::NativeTheme::GetInstanceForNativeUi()

View file

@ -455,6 +455,7 @@ v8::Local<v8::Promise> SystemPreferences::PromptTouchID(
operation:LAAccessControlOperationUseKeySign
localizedReason:[NSString stringWithUTF8String:reason.c_str()]
reply:^(BOOL success, NSError* error) {
// NOLINTBEGIN(bugprone-use-after-move)
if (!success) {
std::string err_msg = std::string(
[error.localizedDescription UTF8String]);
@ -470,6 +471,7 @@ v8::Local<v8::Promise> SystemPreferences::PromptTouchID(
gin_helper::Promise<void>::ResolvePromise,
std::move(p)));
}
// NOLINTEND(bugprone-use-after-move)
}];
return handle;

View file

@ -279,7 +279,7 @@ void UtilityProcessWrapper::PostMessage(gin::Arguments* args) {
bool UtilityProcessWrapper::Kill() const {
if (pid_ == base::kNullProcessId)
return 0;
return false;
base::Process process = base::Process::Open(pid_);
bool result = process.Terminate(content::RESULT_CODE_NORMAL_EXIT, false);
// Refs https://bugs.chromium.org/p/chromium/issues/detail?id=818244

View file

@ -8,7 +8,7 @@
namespace electron {
GPUInfoEnumerator::GPUInfoEnumerator() : value_stack_(), current_{} {}
GPUInfoEnumerator::GPUInfoEnumerator() = default;
GPUInfoEnumerator::~GPUInfoEnumerator() = default;