зеркало из https://github.com/electron/electron.git
refactor: `NativeWindow::Create()` returns a unique_ptr (#43576)
refactor: NativeWindow::Create() returns a unique_ptr
This commit is contained in:
Родитель
fe0d4274e2
Коммит
18b1b33adc
|
@ -98,8 +98,8 @@ BaseWindow::BaseWindow(v8::Isolate* isolate,
|
|||
}
|
||||
|
||||
// Creates NativeWindow.
|
||||
window_.reset(NativeWindow::Create(
|
||||
options, parent.IsEmpty() ? nullptr : parent->window_.get()));
|
||||
window_ = NativeWindow::Create(
|
||||
options, parent.IsEmpty() ? nullptr : parent->window_.get());
|
||||
window_->AddObserver(this);
|
||||
|
||||
SetContentView(View::Create(isolate));
|
||||
|
|
|
@ -71,8 +71,9 @@ class NativeWindow : public base::SupportsUserData,
|
|||
|
||||
// Create window with existing WebContents, the caller is responsible for
|
||||
// managing the window's live.
|
||||
static NativeWindow* Create(const gin_helper::Dictionary& options,
|
||||
NativeWindow* parent = nullptr);
|
||||
static std::unique_ptr<NativeWindow> Create(
|
||||
const gin_helper::Dictionary& options,
|
||||
NativeWindow* parent = nullptr);
|
||||
|
||||
void InitFromOptions(const gin_helper::Dictionary& options);
|
||||
|
||||
|
|
|
@ -1814,9 +1814,10 @@ std::optional<gfx::Rect> NativeWindowMac::GetWindowControlsOverlayRect() {
|
|||
}
|
||||
|
||||
// static
|
||||
NativeWindow* NativeWindow::Create(const gin_helper::Dictionary& options,
|
||||
NativeWindow* parent) {
|
||||
return new NativeWindowMac(options, parent);
|
||||
std::unique_ptr<NativeWindow> NativeWindow::Create(
|
||||
const gin_helper::Dictionary& options,
|
||||
NativeWindow* parent) {
|
||||
return std::make_unique<NativeWindowMac>(options, parent);
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
|
|
@ -1789,9 +1789,10 @@ void NativeWindowViews::MoveBehindTaskBarIfNeeded() {
|
|||
}
|
||||
|
||||
// static
|
||||
NativeWindow* NativeWindow::Create(const gin_helper::Dictionary& options,
|
||||
NativeWindow* parent) {
|
||||
return new NativeWindowViews(options, parent);
|
||||
std::unique_ptr<NativeWindow> NativeWindow::Create(
|
||||
const gin_helper::Dictionary& options,
|
||||
NativeWindow* parent) {
|
||||
return std::make_unique<NativeWindowViews>(options, parent);
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
|
Загрузка…
Ссылка в новой задаче