Commit 821ebe6c authored by Justin Donnelly's avatar Justin Donnelly Committed by Commit Bot

Revert "[jumbo] Make it one g_id_map instead of two."

This reverts commit 41aadb51.

Reason for revert: Introduces static initializers according to https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/mac-rel/552.

Original change's description:
> [jumbo] Make it one g_id_map instead of two.
> 
> A commit just introduced a second g_id_map in ui/views/cocoa,
> which broke jumbo builds. This renames the g_id_map
> globals to the longer names g_id_to_impl_map and
> g_id_to_host_impl_map.
> 
> Bug: 859152
> 
> TBR=ccameron@chromium.org,ellyjones@chromium.org
> 
> Change-Id: Id30d71b67f4bfb7c3ddc3ec8d03c759b5b7df14f
> Reviewed-on: https://chromium-review.googlesource.com/1212862
> Reviewed-by: Daniel Bratell <bratell@opera.com>
> Commit-Queue: Daniel Bratell <bratell@opera.com>
> Cr-Commit-Position: refs/heads/master@{#589465}

TBR=ellyjones@chromium.org,ccameron@chromium.org,bratell@opera.com

Change-Id: I70fdf14f4759f74e9572e0b69884febb2607adcc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 859152
Reviewed-on: https://chromium-review.googlesource.com/1213705Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Commit-Queue: Justin Donnelly <jdonnelly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589620}
parent 26fbd76c
...@@ -227,7 +227,7 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) { ...@@ -227,7 +227,7 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
} }
static base::NoDestructor<std::map<uint64_t, BridgedNativeWidgetImpl*>> static base::NoDestructor<std::map<uint64_t, BridgedNativeWidgetImpl*>>
g_id_to_impl_map; g_id_map;
} // namespace } // namespace
...@@ -244,8 +244,8 @@ gfx::Size BridgedNativeWidgetImpl::GetWindowSizeForClientSize( ...@@ -244,8 +244,8 @@ gfx::Size BridgedNativeWidgetImpl::GetWindowSizeForClientSize(
// static // static
BridgedNativeWidgetImpl* BridgedNativeWidgetImpl::GetFromId( BridgedNativeWidgetImpl* BridgedNativeWidgetImpl::GetFromId(
uint64_t bridged_native_widget_id) { uint64_t bridged_native_widget_id) {
auto found = g_id_to_impl_map.get()->find(bridged_native_widget_id); auto found = g_id_map.get()->find(bridged_native_widget_id);
if (found == g_id_to_impl_map.get()->end()) if (found == g_id_map.get()->end())
return nullptr; return nullptr;
return found->second; return found->second;
} }
...@@ -259,17 +259,17 @@ BridgedNativeWidgetImpl::BridgedNativeWidgetImpl( ...@@ -259,17 +259,17 @@ BridgedNativeWidgetImpl::BridgedNativeWidgetImpl(
host_(host), host_(host),
host_helper_(host_helper), host_helper_(host_helper),
native_widget_mac_(parent) { native_widget_mac_(parent) {
DCHECK(g_id_to_impl_map.get()->find(id_) == g_id_to_impl_map.get()->end()); DCHECK(g_id_map.get()->find(id_) == g_id_map.get()->end());
g_id_to_impl_map.get()->insert(std::make_pair(id_, this)); g_id_map.get()->insert(std::make_pair(id_, this));
DCHECK(parent); DCHECK(parent);
} }
BridgedNativeWidgetImpl::~BridgedNativeWidgetImpl() { BridgedNativeWidgetImpl::~BridgedNativeWidgetImpl() {
// Ensure that |this| cannot be reached by its id while it is being destroyed. // Ensure that |this| cannot be reached by its id while it is being destroyed.
auto found = g_id_to_impl_map.get()->find(id_); auto found = g_id_map.get()->find(id_);
DCHECK(found != g_id_to_impl_map.get()->end()); DCHECK(found != g_id_map.get()->end());
DCHECK_EQ(found->second, this); DCHECK_EQ(found->second, this);
g_id_to_impl_map.get()->erase(found); g_id_map.get()->erase(found);
// The delegate should be cleared already. Note this enforces the precondition // The delegate should be cleared already. Note this enforces the precondition
// that -[NSWindow close] is invoked on the hosted window before the // that -[NSWindow close] is invoked on the hosted window before the
......
...@@ -41,8 +41,7 @@ bool PositionWindowInScreenCoordinates(Widget* widget, ...@@ -41,8 +41,7 @@ bool PositionWindowInScreenCoordinates(Widget* widget,
return widget && widget->is_top_level(); return widget && widget->is_top_level();
} }
base::NoDestructor<std::map<uint64_t, BridgedNativeWidgetHostImpl*>> base::NoDestructor<std::map<uint64_t, BridgedNativeWidgetHostImpl*>> g_id_map;
g_id_to_host_impl_map;
uint64_t g_last_bridged_native_widget_id = 0; uint64_t g_last_bridged_native_widget_id = 0;
...@@ -51,8 +50,8 @@ uint64_t g_last_bridged_native_widget_id = 0; ...@@ -51,8 +50,8 @@ uint64_t g_last_bridged_native_widget_id = 0;
// static // static
BridgedNativeWidgetHostImpl* BridgedNativeWidgetHostImpl::GetFromId( BridgedNativeWidgetHostImpl* BridgedNativeWidgetHostImpl::GetFromId(
uint64_t bridged_native_widget_id) { uint64_t bridged_native_widget_id) {
auto found = g_id_to_host_impl_map.get()->find(bridged_native_widget_id); auto found = g_id_map.get()->find(bridged_native_widget_id);
if (found == g_id_to_host_impl_map.get()->end()) if (found == g_id_map.get()->end())
return nullptr; return nullptr;
return found->second; return found->second;
} }
...@@ -62,18 +61,17 @@ BridgedNativeWidgetHostImpl::BridgedNativeWidgetHostImpl( ...@@ -62,18 +61,17 @@ BridgedNativeWidgetHostImpl::BridgedNativeWidgetHostImpl(
: id_(++g_last_bridged_native_widget_id), : id_(++g_last_bridged_native_widget_id),
native_widget_mac_(parent), native_widget_mac_(parent),
bridge_impl_(new BridgedNativeWidgetImpl(id_, this, this, parent)) { bridge_impl_(new BridgedNativeWidgetImpl(id_, this, this, parent)) {
DCHECK(g_id_to_host_impl_map.get()->find(id_) == DCHECK(g_id_map.get()->find(id_) == g_id_map.get()->end());
g_id_to_host_impl_map.get()->end()); g_id_map.get()->insert(std::make_pair(id_, this));
g_id_to_host_impl_map.get()->insert(std::make_pair(id_, this));
DCHECK(parent); DCHECK(parent);
} }
BridgedNativeWidgetHostImpl::~BridgedNativeWidgetHostImpl() { BridgedNativeWidgetHostImpl::~BridgedNativeWidgetHostImpl() {
// Ensure that |this| cannot be reached by its id while it is being destroyed. // Ensure that |this| cannot be reached by its id while it is being destroyed.
auto found = g_id_to_host_impl_map.get()->find(id_); auto found = g_id_map.get()->find(id_);
DCHECK(found != g_id_to_host_impl_map.get()->end()); DCHECK(found != g_id_map.get()->end());
DCHECK_EQ(found->second, this); DCHECK_EQ(found->second, this);
g_id_to_host_impl_map.get()->erase(found); g_id_map.get()->erase(found);
// Destroy the bridge first to prevent any calls back into this during // Destroy the bridge first to prevent any calls back into this during
// destruction. // destruction.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment