Skip to content

Commit

Permalink
For LazyInstance prefer Leaky over DestructorAtExit
Browse files Browse the repository at this point in the history
Bug: None
Change-Id: I110343f763e96578c34f2cbf402f4cc957fcc086
Reviewed-on: https://chromium-review.googlesource.com/861845
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#528836}
  • Loading branch information
aleventhal authored and Commit Bot committed Jan 12, 2018
1 parent 9931bb2 commit 2c63fea
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ BrowserAccessibility* BrowserAccessibility::Create() {

using UniqueIdMap = base::hash_map<int32_t, BrowserAccessibilityAndroid*>;
// Map from each AXPlatformNode's unique id to its instance.
base::LazyInstance<UniqueIdMap>::DestructorAtExit g_unique_id_map =
base::LazyInstance<UniqueIdMap>::Leaky g_unique_id_map =
LAZY_INSTANCE_INITIALIZER;

// static
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ BrowserAccessibility* FindNodeWithChildTreeId(BrowserAccessibility* node,
// Map from AXTreeID to BrowserAccessibilityManager
using AXTreeIDMap = base::hash_map<ui::AXTreeIDRegistry::AXTreeID,
BrowserAccessibilityManager*>;
base::LazyInstance<AXTreeIDMap>::DestructorAtExit g_ax_tree_id_map =
base::LazyInstance<AXTreeIDMap>::Leaky g_ax_tree_id_map =
LAZY_INSTANCE_INITIALIZER;

// A function to call when focus changes, for testing only.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ enum {

using SearchKeyToPredicateMap =
base::hash_map<base::string16, AccessibilityMatchPredicate>;
base::LazyInstance<SearchKeyToPredicateMap>::DestructorAtExit
base::LazyInstance<SearchKeyToPredicateMap>::Leaky
g_search_key_to_predicate_map = LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<base::string16>::DestructorAtExit g_all_search_keys =
base::LazyInstance<base::string16>::Leaky g_all_search_keys =
LAZY_INSTANCE_INITIALIZER;

bool SectionPredicate(BrowserAccessibility* start, BrowserAccessibility* node) {
Expand Down
9 changes: 4 additions & 5 deletions ui/accessibility/platform/ax_platform_node_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,11 @@ namespace {
typedef base::hash_set<AXPlatformNodeWin*> AXPlatformNodeWinSet;
// Set of all AXPlatformNodeWin objects that were the target of an
// alert event.
base::LazyInstance<AXPlatformNodeWinSet>::DestructorAtExit g_alert_targets =
base::LazyInstance<AXPlatformNodeWinSet>::Leaky g_alert_targets =
LAZY_INSTANCE_INITIALIZER;

base::LazyInstance<base::ObserverList<IAccessible2UsageObserver>>::
DestructorAtExit g_iaccessible2_usage_observer_list =
LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<base::ObserverList<IAccessible2UsageObserver>>::Leaky
g_iaccessible2_usage_observer_list = LAZY_INSTANCE_INITIALIZER;

} // namespace

Expand Down Expand Up @@ -227,7 +226,7 @@ AXPlatformNode* AXPlatformNode::FromNativeViewAccessible(

using UniqueIdMap = base::hash_map<int32_t, AXPlatformNode*>;
// Map from each AXPlatformNode's unique id to its instance.
base::LazyInstance<UniqueIdMap>::DestructorAtExit g_unique_id_map =
base::LazyInstance<UniqueIdMap>::Leaky g_unique_id_map =
LAZY_INSTANCE_INITIALIZER;

// static
Expand Down

0 comments on commit 2c63fea

Please sign in to comment.