refactor: make TrackableObject::weak_map_id() constexpr (#47092)
* refactor: make TrackableObject::weak_map_id() constexpr refactor: make BaseWindow::GetID() inline and constexpr * refactor: make NativeWindow::window_id() constexpr too
This commit is contained in:
parent
e2bcd8f0aa
commit
d720aea700
4 changed files with 3 additions and 7 deletions
|
@ -1154,10 +1154,6 @@ void BaseWindow::SetTitleBarOverlay(const gin_helper::Dictionary& options,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int32_t BaseWindow::GetID() const {
|
|
||||||
return weak_map_id();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseWindow::RemoveFromParentChildWindows() {
|
void BaseWindow::RemoveFromParentChildWindows() {
|
||||||
if (parent_window_.IsEmpty())
|
if (parent_window_.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -261,7 +261,7 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
|
||||||
void SetTitleBarOverlay(const gin_helper::Dictionary& options,
|
void SetTitleBarOverlay(const gin_helper::Dictionary& options,
|
||||||
gin_helper::Arguments* args);
|
gin_helper::Arguments* args);
|
||||||
#endif
|
#endif
|
||||||
int32_t GetID() const;
|
[[nodiscard]] constexpr int32_t GetID() const { return weak_map_id(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Helpers.
|
// Helpers.
|
||||||
|
|
|
@ -406,7 +406,7 @@ class NativeWindow : public base::SupportsUserData,
|
||||||
NativeWindow* parent() const { return parent_; }
|
NativeWindow* parent() const { return parent_; }
|
||||||
bool is_modal() const { return is_modal_; }
|
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) {
|
void add_child_window(NativeWindow* child) {
|
||||||
child_windows_.push_back(child);
|
child_windows_.push_back(child);
|
||||||
|
|
|
@ -28,7 +28,7 @@ class TrackableObjectBase : public CleanedUpAtExit {
|
||||||
TrackableObjectBase& operator=(const TrackableObjectBase&) = delete;
|
TrackableObjectBase& operator=(const TrackableObjectBase&) = delete;
|
||||||
|
|
||||||
// The ID in weak map.
|
// 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.
|
// Wrap TrackableObject into a class that SupportsUserData.
|
||||||
void AttachAsUserData(base::SupportsUserData* wrapped);
|
void AttachAsUserData(base::SupportsUserData* wrapped);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue