refactor: make TrackableObject::weak_map_id() constexpr (#47115)
* refactor: make TrackableObject::weak_map_id() constexpr refactor: make BaseWindow::GetID() inline and constexpr Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: make NativeWindow::window_id() constexpr too Co-authored-by: Charles Kerr <charles@charleskerr.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
parent
917e95433a
commit
7cb5a46b66
4 changed files with 3 additions and 7 deletions
|
@ -1154,10 +1154,6 @@ void BaseWindow::SetTitleBarOverlay(const gin_helper::Dictionary& options,
|
|||
}
|
||||
#endif
|
||||
|
||||
int32_t BaseWindow::GetID() const {
|
||||
return weak_map_id();
|
||||
}
|
||||
|
||||
void BaseWindow::RemoveFromParentChildWindows() {
|
||||
if (parent_window_.IsEmpty())
|
||||
return;
|
||||
|
|
|
@ -261,7 +261,7 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
|
|||
void SetTitleBarOverlay(const gin_helper::Dictionary& options,
|
||||
gin_helper::Arguments* args);
|
||||
#endif
|
||||
int32_t GetID() const;
|
||||
[[nodiscard]] constexpr int32_t GetID() const { return weak_map_id(); }
|
||||
|
||||
private:
|
||||
// Helpers.
|
||||
|
|
|
@ -405,7 +405,7 @@ class NativeWindow : public base::SupportsUserData,
|
|||
NativeWindow* parent() const { return parent_; }
|
||||
bool is_modal() const { return is_modal_; }
|
||||
|
||||
int32_t window_id() const { return window_id_; }
|
||||
[[nodiscard]] constexpr int32_t window_id() const { return window_id_; }
|
||||
|
||||
void add_child_window(NativeWindow* child) {
|
||||
child_windows_.push_back(child);
|
||||
|
|
|
@ -28,7 +28,7 @@ class TrackableObjectBase : public CleanedUpAtExit {
|
|||
TrackableObjectBase& operator=(const TrackableObjectBase&) = delete;
|
||||
|
||||
// The ID in weak map.
|
||||
int32_t weak_map_id() const { return weak_map_id_; }
|
||||
[[nodiscard]] constexpr int32_t weak_map_id() const { return weak_map_id_; }
|
||||
|
||||
// Wrap TrackableObject into a class that SupportsUserData.
|
||||
void AttachAsUserData(base::SupportsUserData* wrapped);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue