Skip to content

Commit

Permalink
refactor: make NativeWindowClientView::window_ a raw_ref
Browse files Browse the repository at this point in the history
Xref: https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++.md\#non_owning-pointers-in-class-fields

Prefer const raw_ref<T> whenever the held pointer will never be null
  • Loading branch information
ckerr committed Jun 1, 2023
1 parent 4f7e8d4 commit 248b38f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions shell/browser/native_window_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ class NativeWindowClientView : public views::ClientView {
public:
NativeWindowClientView(views::Widget* widget,
views::View* root_view,
NativeWindowViews* window)
: views::ClientView(widget, root_view), window_(window) {}
NativeWindowViews& window)
: views::ClientView{widget, root_view}, window_{window} {}
~NativeWindowClientView() override = default;

// disable copy
Expand All @@ -178,7 +178,7 @@ class NativeWindowClientView : public views::ClientView {
}

private:
raw_ptr<NativeWindowViews> window_;
const raw_ref<NativeWindowViews> window_;
};

} // namespace
Expand Down Expand Up @@ -1636,7 +1636,7 @@ bool NativeWindowViews::ShouldDescendIntoChildForEventHandling(
}

views::ClientView* NativeWindowViews::CreateClientView(views::Widget* widget) {
return new NativeWindowClientView{widget, GetContentsView(), this};
return new NativeWindowClientView{widget, GetContentsView(), *this};
}

std::unique_ptr<views::NonClientFrameView>
Expand Down

0 comments on commit 248b38f

Please sign in to comment.