Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1362)

Unified Diff: cc/debug/micro_benchmark_controller_impl.cc

Issue 1437413002: cc: Remove ScopedPtrVector and cc::remove_if. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just the vector Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/debug/micro_benchmark_controller_impl.cc
diff --git a/cc/debug/micro_benchmark_controller_impl.cc b/cc/debug/micro_benchmark_controller_impl.cc
index 821ba5f8d4493c6cacc7d5483937a5bc60e4475e..2cd1a796c708598b7a846319888be3dced4a6bef 100644
--- a/cc/debug/micro_benchmark_controller_impl.cc
+++ b/cc/debug/micro_benchmark_controller_impl.cc
@@ -12,20 +12,6 @@
namespace cc {
-namespace {
-
-class IsDonePredicate {
- public:
- typedef const MicroBenchmarkImpl* argument_type;
- typedef bool result_type;
-
- result_type operator()(argument_type benchmark) const {
- return benchmark->IsDone();
- }
-};
-
-} // namespace
-
MicroBenchmarkControllerImpl::MicroBenchmarkControllerImpl(
LayerTreeHostImpl* host)
: host_(host) {
@@ -40,9 +26,9 @@ void MicroBenchmarkControllerImpl::ScheduleRun(
}
void MicroBenchmarkControllerImpl::DidCompleteCommit() {
- for (ScopedPtrVector<MicroBenchmarkImpl>::iterator it = benchmarks_.begin();
- it != benchmarks_.end();
- ++it) {
+ for (std::vector<scoped_ptr<MicroBenchmarkImpl>>::iterator it =
danakj 2015/11/17 01:12:17 auto, ranged-based
vmpstr 2015/11/17 23:26:23 Done.
+ benchmarks_.begin();
+ it != benchmarks_.end(); ++it) {
DCHECK(!(*it)->IsDone());
(*it)->DidCompleteCommit(host_);
}
@@ -52,7 +38,10 @@ void MicroBenchmarkControllerImpl::DidCompleteCommit() {
void MicroBenchmarkControllerImpl::CleanUpFinishedBenchmarks() {
benchmarks_.erase(
- benchmarks_.partition(std::not1(IsDonePredicate())),
+ std::remove_if(benchmarks_.begin(), benchmarks_.end(),
+ [](const scoped_ptr<MicroBenchmarkImpl>& benchmark) {
+ return benchmark->IsDone();
danakj 2015/11/17 01:12:17 did you mean the inverse?
vmpstr 2015/11/17 23:26:23 Nope :)
+ }),
benchmarks_.end());
}

Powered by Google App Engine
This is Rietveld 408576698