From 93a6f3e60739a58dedb5b50563e0cb8e7ed46e29 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 20 Aug 2024 14:34:59 -0500 Subject: [PATCH] refactor: NodeBindings::Create() returns a unique_ptr (#43361) * refactor: NodeBindings::Create() returns a unique_ptr * empty commit --- shell/common/node_bindings.h | 2 +- shell/common/node_bindings_linux.cc | 4 ++-- shell/common/node_bindings_mac.cc | 4 ++-- shell/common/node_bindings_win.cc | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/shell/common/node_bindings.h b/shell/common/node_bindings.h index bb25287dd30e..ad556454227a 100644 --- a/shell/common/node_bindings.h +++ b/shell/common/node_bindings.h @@ -84,7 +84,7 @@ class NodeBindings { public: enum class BrowserEnvironment { kBrowser, kRenderer, kUtility, kWorker }; - static NodeBindings* Create(BrowserEnvironment browser_env); + static std::unique_ptr Create(BrowserEnvironment browser_env); static void RegisterBuiltinBindings(); static bool IsInitialized(); diff --git a/shell/common/node_bindings_linux.cc b/shell/common/node_bindings_linux.cc index ad598105c9c8..7af0b151e695 100644 --- a/shell/common/node_bindings_linux.cc +++ b/shell/common/node_bindings_linux.cc @@ -33,8 +33,8 @@ void NodeBindingsLinux::PollEvents() { } // static -NodeBindings* NodeBindings::Create(BrowserEnvironment browser_env) { - return new NodeBindingsLinux(browser_env); +std::unique_ptr NodeBindings::Create(BrowserEnvironment env) { + return std::make_unique(env); } } // namespace electron diff --git a/shell/common/node_bindings_mac.cc b/shell/common/node_bindings_mac.cc index e50afcdf6a44..b6a92c54a0bb 100644 --- a/shell/common/node_bindings_mac.cc +++ b/shell/common/node_bindings_mac.cc @@ -41,8 +41,8 @@ void NodeBindingsMac::PollEvents() { } // static -NodeBindings* NodeBindings::Create(BrowserEnvironment browser_env) { - return new NodeBindingsMac(browser_env); +std::unique_ptr NodeBindings::Create(BrowserEnvironment env) { + return std::make_unique(env); } } // namespace electron diff --git a/shell/common/node_bindings_win.cc b/shell/common/node_bindings_win.cc index e6efce987dea..6c2aeffb27d0 100644 --- a/shell/common/node_bindings_win.cc +++ b/shell/common/node_bindings_win.cc @@ -50,8 +50,8 @@ void NodeBindingsWin::PollEvents() { } // static -NodeBindings* NodeBindings::Create(BrowserEnvironment browser_env) { - return new NodeBindingsWin(browser_env); +std::unique_ptr NodeBindings::Create(BrowserEnvironment env) { + return std::make_unique(env); } } // namespace electron