Commit 4f45d828 authored by Daniel Cheng's avatar Daniel Cheng Committed by Commit Bot

//ui/accessibility: use base::EmptyString() where appropriate

Other empty containers are marked as const to ensure that they stay
empty.

Change-Id: I6771a853cf3cde47fcdcff1e3af7862234f04683
Reviewed-on: https://chromium-review.googlesource.com/c/1298399Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602520}
parent 4a1a478e
......@@ -311,9 +311,8 @@ bool AXNodeData::HasStringAttribute(
const std::string& AXNodeData::GetStringAttribute(
ax::mojom::StringAttribute attribute) const {
static base::NoDestructor<std::string> empty_string;
auto iter = FindInVectorOfPairs(attribute, string_attributes);
return iter != string_attributes.end() ? iter->second : *empty_string;
return iter != string_attributes.end() ? iter->second : base::EmptyString();
}
bool AXNodeData::GetStringAttribute(ax::mojom::StringAttribute attribute,
......@@ -352,7 +351,7 @@ bool AXNodeData::HasIntListAttribute(
const std::vector<int32_t>& AXNodeData::GetIntListAttribute(
ax::mojom::IntListAttribute attribute) const {
static base::NoDestructor<std::vector<int32_t>> empty_vector;
static const base::NoDestructor<std::vector<int32_t>> empty_vector;
auto iter = FindInVectorOfPairs(attribute, intlist_attributes);
if (iter != intlist_attributes.end())
return iter->second;
......@@ -378,7 +377,7 @@ bool AXNodeData::HasStringListAttribute(
const std::vector<std::string>& AXNodeData::GetStringListAttribute(
ax::mojom::StringListAttribute attribute) const {
static base::NoDestructor<std::vector<std::string>> empty_vector;
static const base::NoDestructor<std::vector<std::string>> empty_vector;
auto iter = FindInVectorOfPairs(attribute, stringlist_attributes);
if (iter != stringlist_attributes.end())
return iter->second;
......
......@@ -28,7 +28,7 @@ void AXPlatformNodeBase::Init(AXPlatformNodeDelegate* delegate) {
}
const AXNodeData& AXPlatformNodeBase::GetData() const {
static base::NoDestructor<AXNodeData> empty_data;
static const base::NoDestructor<AXNodeData> empty_data;
if (delegate_)
return delegate_->GetData();
return *empty_data;
......@@ -190,9 +190,8 @@ bool AXPlatformNodeBase::HasStringAttribute(
const std::string& AXPlatformNodeBase::GetStringAttribute(
ax::mojom::StringAttribute attribute) const {
static base::NoDestructor<std::string> empty_data;
if (!delegate_)
return *empty_data;
return base::EmptyString();
return GetData().GetStringAttribute(attribute);
}
......@@ -228,7 +227,7 @@ bool AXPlatformNodeBase::HasIntListAttribute(
const std::vector<int32_t>& AXPlatformNodeBase::GetIntListAttribute(
ax::mojom::IntListAttribute attribute) const {
static base::NoDestructor<std::vector<int32_t>> empty_data;
static const base::NoDestructor<std::vector<int32_t>> empty_data;
if (!delegate_)
return *empty_data;
return GetData().GetIntListAttribute(attribute);
......
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