| Index: ui/accessibility/platform/ax_platform_node.cc
 | 
| diff --git a/ui/accessibility/platform/ax_platform_node.cc b/ui/accessibility/platform/ax_platform_node.cc
 | 
| index 8f889458ddb28af0c6334f6577233b0ecdc44b16..adfcc1e2ad2f2059b4f9d299242e7378e19fcc0c 100644
 | 
| --- a/ui/accessibility/platform/ax_platform_node.cc
 | 
| +++ b/ui/accessibility/platform/ax_platform_node.cc
 | 
| @@ -4,12 +4,23 @@
 | 
|  
 | 
|  #include "ui/accessibility/platform/ax_platform_node.h"
 | 
|  
 | 
| +#include "base/containers/hash_tables.h"
 | 
| +#include "base/lazy_instance.h"
 | 
|  #include "build/build_config.h"
 | 
|  #include "ui/accessibility/ax_node_data.h"
 | 
|  #include "ui/accessibility/platform/ax_platform_node_delegate.h"
 | 
|  
 | 
|  namespace ui {
 | 
|  
 | 
| +namespace {
 | 
| +
 | 
| +using UniqueIdMap = base::hash_map<int32_t, AXPlatformNode*>;
 | 
| +// Map from each AXPlatformNode's unique id to its instance.
 | 
| +base::LazyInstance<UniqueIdMap> g_unique_id_map =
 | 
| +    LAZY_INSTANCE_INITIALIZER;
 | 
| +
 | 
| +}
 | 
| +
 | 
|  #if !defined(PLATFORM_HAS_AX_PLATFORM_NODE_IMPL)
 | 
|  // static
 | 
|  AXPlatformNode* AXPlatformNode::Create(AXPlatformNodeDelegate* delegate) {
 | 
| @@ -28,10 +39,39 @@ AXPlatformNode* AXPlatformNode::FromNativeViewAccessible(
 | 
|  }
 | 
|  #endif
 | 
|  
 | 
| -AXPlatformNode::AXPlatformNode() {
 | 
| +// static
 | 
| +int32_t AXPlatformNode::GetNextUniqueId() {
 | 
| +  static int32_t next_unique_id = 1;
 | 
| +  int32_t unique_id = next_unique_id;
 | 
| +  if (next_unique_id == INT32_MAX)
 | 
| +    next_unique_id = 1;
 | 
| +  else
 | 
| +    next_unique_id++;
 | 
| +
 | 
| +  return unique_id;
 | 
| +}
 | 
| +
 | 
| +AXPlatformNode::AXPlatformNode() : unique_id_(GetNextUniqueId()) {
 | 
| +  g_unique_id_map.Get()[unique_id_] = this;
 | 
|  }
 | 
|  
 | 
|  AXPlatformNode::~AXPlatformNode() {
 | 
| +  if (unique_id_)
 | 
| +    g_unique_id_map.Get().erase(unique_id_);
 | 
| +}
 | 
| +
 | 
| +void AXPlatformNode::Destroy() {
 | 
| +  g_unique_id_map.Get().erase(unique_id_);
 | 
| +  unique_id_ = 0;
 | 
| +}
 | 
| +
 | 
| +AXPlatformNode* AXPlatformNode::GetFromUniqueId(int32_t unique_id) {
 | 
| +  UniqueIdMap* unique_ids = g_unique_id_map.Pointer();
 | 
| +  auto iter = unique_ids->find(unique_id);
 | 
| +  if (iter != unique_ids->end())
 | 
| +    return iter->second;
 | 
| +
 | 
| +  return nullptr;
 | 
|  }
 | 
|  
 | 
|  }  // namespace ui
 | 
| 
 |