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