refactor: run clang-tidy (#20231)
* refactor: clang-tidy modernize-use-nullptr * refactor: clang-tidy modernize-use-equals-default * refactor: clang-tidy modernize-make-unique * refactor: omit nullptr arg from unique_ptr.reset() As per comment by @miniak
This commit is contained in:
parent
660e566201
commit
2b316f3843
93 changed files with 261 additions and 223 deletions
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "shell/browser/api/atom_api_app.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -941,9 +943,9 @@ std::string App::GetLocaleCountryCode() {
|
|||
kCFStringEncodingUTF8);
|
||||
region = temporaryCString;
|
||||
#else
|
||||
const char* locale_ptr = setlocale(LC_TIME, NULL);
|
||||
const char* locale_ptr = setlocale(LC_TIME, nullptr);
|
||||
if (!locale_ptr)
|
||||
locale_ptr = setlocale(LC_NUMERIC, NULL);
|
||||
locale_ptr = setlocale(LC_NUMERIC, nullptr);
|
||||
if (locale_ptr) {
|
||||
std::string locale = locale_ptr;
|
||||
std::string::size_type rpos = locale.find('.');
|
||||
|
@ -977,8 +979,8 @@ bool App::RequestSingleInstanceLock() {
|
|||
|
||||
auto cb = base::BindRepeating(&App::OnSecondInstance, base::Unretained(this));
|
||||
|
||||
process_singleton_.reset(new ProcessSingleton(
|
||||
user_dir, base::BindRepeating(NotificationCallbackWrapper, cb)));
|
||||
process_singleton_ = std::make_unique<ProcessSingleton>(
|
||||
user_dir, base::BindRepeating(NotificationCallbackWrapper, cb));
|
||||
|
||||
switch (process_singleton_->NotifyOtherProcessOrCreate()) {
|
||||
case ProcessSingleton::NotifyResult::LOCK_ERROR:
|
||||
|
|
|
@ -167,7 +167,7 @@ Cookies::Cookies(v8::Isolate* isolate, AtomBrowserContext* browser_context)
|
|||
base::Unretained(this)));
|
||||
}
|
||||
|
||||
Cookies::~Cookies() {}
|
||||
Cookies::~Cookies() = default;
|
||||
|
||||
v8::Local<v8::Promise> Cookies::Get(const base::DictionaryValue& filter) {
|
||||
util::Promise<net::CookieList> promise(isolate());
|
||||
|
|
|
@ -27,7 +27,7 @@ Debugger::Debugger(v8::Isolate* isolate, content::WebContents* web_contents)
|
|||
Init(isolate);
|
||||
}
|
||||
|
||||
Debugger::~Debugger() {}
|
||||
Debugger::~Debugger() = default;
|
||||
|
||||
void Debugger::AgentHostClosed(DevToolsAgentHost* agent_host) {
|
||||
DCHECK(agent_host == agent_host_);
|
||||
|
|
|
@ -62,7 +62,7 @@ DesktopCapturer::DesktopCapturer(v8::Isolate* isolate) {
|
|||
Init(isolate);
|
||||
}
|
||||
|
||||
DesktopCapturer::~DesktopCapturer() {}
|
||||
DesktopCapturer::~DesktopCapturer() = default;
|
||||
|
||||
void DesktopCapturer::StartHandling(bool capture_window,
|
||||
bool capture_screen,
|
||||
|
@ -90,18 +90,18 @@ void DesktopCapturer::StartHandling(bool capture_window,
|
|||
// Initialize the source list.
|
||||
// Apply the new thumbnail size and restart capture.
|
||||
if (capture_window) {
|
||||
window_capturer_.reset(new NativeDesktopMediaList(
|
||||
window_capturer_ = std::make_unique<NativeDesktopMediaList>(
|
||||
content::DesktopMediaID::TYPE_WINDOW,
|
||||
content::desktop_capture::CreateWindowCapturer()));
|
||||
content::desktop_capture::CreateWindowCapturer());
|
||||
window_capturer_->SetThumbnailSize(thumbnail_size);
|
||||
window_capturer_->AddObserver(this);
|
||||
window_capturer_->StartUpdating();
|
||||
}
|
||||
|
||||
if (capture_screen) {
|
||||
screen_capturer_.reset(new NativeDesktopMediaList(
|
||||
screen_capturer_ = std::make_unique<NativeDesktopMediaList>(
|
||||
content::DesktopMediaID::TYPE_SCREEN,
|
||||
content::desktop_capture::CreateScreenCapturer()));
|
||||
content::desktop_capture::CreateScreenCapturer());
|
||||
screen_capturer_->SetThumbnailSize(thumbnail_size);
|
||||
screen_capturer_->AddObserver(this);
|
||||
screen_capturer_->StartUpdating();
|
||||
|
|
|
@ -51,7 +51,7 @@ void MenuViews::PopupAt(TopLevelWindow* window,
|
|||
menu_runners_[window_id] =
|
||||
std::make_unique<MenuRunner>(model(), flags, close_callback);
|
||||
menu_runners_[window_id]->RunMenuAt(
|
||||
native_window->widget(), NULL, gfx::Rect(location, gfx::Size()),
|
||||
native_window->widget(), nullptr, gfx::Rect(location, gfx::Size()),
|
||||
views::MenuAnchorPosition::kTopLeft, ui::MENU_SOURCE_MOUSE);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ Net::Net(v8::Isolate* isolate) {
|
|||
Init(isolate);
|
||||
}
|
||||
|
||||
Net::~Net() {}
|
||||
Net::~Net() = default;
|
||||
|
||||
// static
|
||||
v8::Local<v8::Value> Net::Create(v8::Isolate* isolate) {
|
||||
|
|
|
@ -49,7 +49,7 @@ PowerSaveBlocker::PowerSaveBlocker(v8::Isolate* isolate)
|
|||
: current_lock_type_(device::mojom::WakeLockType::kPreventAppSuspension),
|
||||
is_wake_lock_active_(false) {}
|
||||
|
||||
PowerSaveBlocker::~PowerSaveBlocker() {}
|
||||
PowerSaveBlocker::~PowerSaveBlocker() = default;
|
||||
|
||||
void PowerSaveBlocker::UpdatePowerSaveBlocker() {
|
||||
if (wake_lock_types_.empty()) {
|
||||
|
|
|
@ -183,7 +183,7 @@ URLRequestNS::URLRequestNS(mate::Arguments* args) : weak_factory_(this) {
|
|||
InitWith(args->isolate(), args->GetThis());
|
||||
}
|
||||
|
||||
URLRequestNS::~URLRequestNS() {}
|
||||
URLRequestNS::~URLRequestNS() = default;
|
||||
|
||||
bool URLRequestNS::NotStarted() const {
|
||||
return request_state_ == 0;
|
||||
|
|
|
@ -387,8 +387,8 @@ WebContents::WebContents(v8::Isolate* isolate, const mate::Dictionary& options)
|
|||
GURL("chrome-guest://fake-host"));
|
||||
content::WebContents::CreateParams params(session->browser_context(),
|
||||
site_instance);
|
||||
guest_delegate_.reset(
|
||||
new WebViewGuestDelegate(embedder_->web_contents(), this));
|
||||
guest_delegate_ =
|
||||
std::make_unique<WebViewGuestDelegate>(embedder_->web_contents(), this);
|
||||
params.guest_delegate = guest_delegate_.get();
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
|
@ -828,7 +828,7 @@ std::unique_ptr<content::BluetoothChooser> WebContents::RunBluetoothChooser(
|
|||
content::JavaScriptDialogManager* WebContents::GetJavaScriptDialogManager(
|
||||
content::WebContents* source) {
|
||||
if (!dialog_manager_)
|
||||
dialog_manager_.reset(new AtomJavaScriptDialogManager(this));
|
||||
dialog_manager_ = std::make_unique<AtomJavaScriptDialogManager>(this);
|
||||
|
||||
return dialog_manager_.get();
|
||||
}
|
||||
|
@ -2038,8 +2038,8 @@ void WebContents::BeginFrameSubscription(mate::Arguments* args) {
|
|||
return;
|
||||
}
|
||||
|
||||
frame_subscriber_.reset(
|
||||
new FrameSubscriber(web_contents(), callback, only_dirty));
|
||||
frame_subscriber_ =
|
||||
std::make_unique<FrameSubscriber>(web_contents(), callback, only_dirty);
|
||||
}
|
||||
|
||||
void WebContents::EndFrameSubscription() {
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace {
|
|||
class WebContentsViewRelay
|
||||
: public content::WebContentsUserData<WebContentsViewRelay> {
|
||||
public:
|
||||
~WebContentsViewRelay() override {}
|
||||
~WebContentsViewRelay() override = default;
|
||||
|
||||
private:
|
||||
explicit WebContentsViewRelay(content::WebContents* contents) {}
|
||||
|
|
|
@ -15,7 +15,7 @@ Event::Event(v8::Isolate* isolate) {
|
|||
Init(isolate);
|
||||
}
|
||||
|
||||
Event::~Event() {}
|
||||
Event::~Event() = default;
|
||||
|
||||
void Event::SetCallback(base::Optional<MessageSyncCallback> callback) {
|
||||
DCHECK(!callback_);
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace electron {
|
|||
GPUInfoEnumerator::GPUInfoEnumerator()
|
||||
: value_stack(), current(std::make_unique<base::DictionaryValue>()) {}
|
||||
|
||||
GPUInfoEnumerator::~GPUInfoEnumerator() {}
|
||||
GPUInfoEnumerator::~GPUInfoEnumerator() = default;
|
||||
|
||||
void GPUInfoEnumerator::AddInt64(const char* name, int64_t value) {
|
||||
current->SetInteger(name, value);
|
||||
|
|
|
@ -20,7 +20,7 @@ SavePageHandler::SavePageHandler(content::WebContents* web_contents,
|
|||
util::Promise<void*> promise)
|
||||
: web_contents_(web_contents), promise_(std::move(promise)) {}
|
||||
|
||||
SavePageHandler::~SavePageHandler() {}
|
||||
SavePageHandler::~SavePageHandler() = default;
|
||||
|
||||
void SavePageHandler::OnDownloadCreated(content::DownloadManager* manager,
|
||||
download::DownloadItem* item) {
|
||||
|
|
|
@ -35,7 +35,7 @@ TrackableObjectBase::TrackableObjectBase() : weak_factory_(this) {
|
|||
GetDestroyClosure());
|
||||
}
|
||||
|
||||
TrackableObjectBase::~TrackableObjectBase() {}
|
||||
TrackableObjectBase::~TrackableObjectBase() = default;
|
||||
|
||||
base::OnceClosure TrackableObjectBase::GetDestroyClosure() {
|
||||
return base::BindOnce(&TrackableObjectBase::Destroy,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue