Commit 897c21ef authored by JungHoon Lee's avatar JungHoon Lee Committed by Commit Bot

Use base::Erase(), base::EraseIf() in ui/

This patch simplifies the code
by using base::Erase() and base::EraseIf()
instead of erase(std::remove) and erase(std::remove_if)

Bug: 875665
Change-Id: I92d02ad090029fb6884b53f05d2de7715a72314a
Reviewed-on: https://chromium-review.googlesource.com/1189583Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Jinho Bang <jinho.bang@samsung.com>
Cr-Commit-Position: refs/heads/master@{#586388}
parent c74a830c
......@@ -438,6 +438,7 @@ Julien Racle <jracle@logitech.com>
Jun Fang <jun_fang@foxitsoftware.com>
Jun Jiang <jun.a.jiang@intel.com>
Junchao Han <junchao.han@intel.com>
Junghoon Lee <sjh836@gmail.com>
JungJik Lee <jungjik.lee@samsung.com>
Jungkee Song <jungkee.song@samsung.com>
Junmin Zhu <junmin.zhu@intel.com>
......
......@@ -3,7 +3,9 @@
// found in the LICENSE file.
#include "ui/accessibility/platform/test_ax_node_wrapper.h"
#include "base/containers/hash_tables.h"
#include "base/stl_util.h"
#include "ui/accessibility/ax_action_data.h"
#include "ui/accessibility/ax_table_info.h"
#include "ui/gfx/geometry/rect_conversions.h"
......@@ -184,10 +186,9 @@ void TestAXNodeWrapper::ReplaceIntAttribute(int32_t node_id,
std::vector<std::pair<ax::mojom::IntAttribute, int32_t>>& attributes =
new_data.int_attributes;
auto deleted = std::remove_if(
attributes.begin(), attributes.end(),
[attribute](auto& pair) { return pair.first == attribute; });
attributes.erase(deleted, attributes.end());
base::EraseIf(attributes, [attribute](auto& pair) {
return pair.first == attribute;
});
new_data.AddIntAttribute(attribute, value);
node->SetData(new_data);
......
......@@ -9,6 +9,7 @@
#include <memory>
#include "base/logging.h"
#include "base/stl_util.h"
#include "base/trace_event/trace_event.h"
#include "cc/animation/animation_host.h"
#include "cc/animation/animation_id_provider.h"
......@@ -380,14 +381,10 @@ void LayerAnimator::AddOwnedObserver(
void LayerAnimator::RemoveAndDestroyOwnedObserver(
ImplicitAnimationObserver* animation_observer) {
owned_observer_list_.erase(
std::remove_if(
owned_observer_list_.begin(), owned_observer_list_.end(),
[animation_observer](
const std::unique_ptr<ImplicitAnimationObserver>& other) {
return other.get() == animation_observer;
}),
owned_observer_list_.end());
base::EraseIf(owned_observer_list_,[animation_observer](
const std::unique_ptr<ImplicitAnimationObserver>& other) {
return other.get() == animation_observer;
});
}
void LayerAnimator::OnThreadedAnimationStarted(
......
......@@ -130,16 +130,14 @@ std::vector<DisplayInfo> FindAndRemoveTouchingDisplayInfos(
const DisplayInfo& ref_display_info,
std::vector<DisplayInfo>* display_infos) {
std::vector<DisplayInfo> touching_display_infos;
display_infos->erase(
std::remove_if(display_infos->begin(), display_infos->end(),
[&touching_display_infos, ref_display_info](
const DisplayInfo& display_info) {
if (DisplayInfosTouch(ref_display_info, display_info)) {
touching_display_infos.push_back(display_info);
return true;
}
return false;
}), display_infos->end());
base::EraseIf(*display_infos, [&touching_display_infos, ref_display_info](
const DisplayInfo& display_info) {
if (DisplayInfosTouch(ref_display_info, display_info)) {
touching_display_infos.push_back(display_info);
return true;
}
return false;
});
return touching_display_infos;
}
......
......@@ -208,9 +208,7 @@ std::string FilterGLExtensionList(
auto is_disabled = [&disabled_extensions](const base::StringPiece& ext) {
return base::ContainsValue(disabled_extensions, ext);
};
extension_vec.erase(
std::remove_if(extension_vec.begin(), extension_vec.end(), is_disabled),
extension_vec.end());
base::EraseIf(extension_vec, is_disabled);
return base::JoinString(extension_vec, " ");
}
......
......@@ -4,6 +4,7 @@
#include "ui/message_center/views/message_popup_collection.h"
#include "base/stl_util.h"
#include "ui/gfx/animation/linear_animation.h"
#include "ui/gfx/animation/tween.h"
#include "ui/message_center/message_center.h"
......@@ -518,10 +519,7 @@ void MessagePopupCollection::ClosePopupsOutsideWorkArea() {
}
void MessagePopupCollection::RemoveClosedPopupItems() {
popup_items_.erase(
std::remove_if(popup_items_.begin(), popup_items_.end(),
[](const auto& item) { return !item.popup; }),
popup_items_.end());
base::EraseIf(popup_items_, [](const auto& item) { return !item.popup; });
}
bool MessagePopupCollection::CollapseAllPopups() {
......
......@@ -4,6 +4,7 @@
#include "ui/message_center/views/message_popup_collection.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/display/display.h"
......@@ -62,8 +63,7 @@ class MockMessagePopupCollection : public MessagePopupCollection {
}
void RemovePopup(MockMessagePopupView* popup) {
popups_.erase(std::remove(popups_.begin(), popups_.end(), popup),
popups_.end());
base::Erase(popups_, popup);
}
bool IsAnimating() { return animation()->is_animating(); }
......
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