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

Unified Diff: cc/debug/micro_benchmark_controller.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.cc
diff --git a/cc/debug/micro_benchmark_controller.cc b/cc/debug/micro_benchmark_controller.cc
index a0dc306612fa77c0d65a0c45ce3adf488eaf64ed..8353e99c4a44c000438b457255a2bb93cd6fc205 100644
--- a/cc/debug/micro_benchmark_controller.cc
+++ b/cc/debug/micro_benchmark_controller.cc
@@ -37,16 +37,6 @@ scoped_ptr<MicroBenchmark> CreateBenchmark(
return nullptr;
}
-class IsDonePredicate {
- public:
- typedef const MicroBenchmark* argument_type;
- typedef bool result_type;
-
- result_type operator()(argument_type benchmark) const {
- return benchmark->IsDone();
- }
-};
-
} // namespace
MicroBenchmarkController::MicroBenchmarkController(LayerTreeHost* host)
@@ -85,9 +75,9 @@ int MicroBenchmarkController::GetNextIdAndIncrement() {
bool MicroBenchmarkController::SendMessage(int id,
scoped_ptr<base::Value> value) {
- for (ScopedPtrVector<MicroBenchmark>::iterator it = benchmarks_.begin();
- it != benchmarks_.end();
- ++it) {
+ for (std::vector<scoped_ptr<MicroBenchmark>>::iterator it =
danakj 2015/11/17 01:12:16 auto. also range-based?
vmpstr 2015/11/17 23:26:23 Done.
+ benchmarks_.begin();
+ it != benchmarks_.end(); ++it) {
if ((*it)->id() == id)
return (*it)->ProcessMessage(value.Pass());
}
@@ -96,9 +86,9 @@ bool MicroBenchmarkController::SendMessage(int id,
void MicroBenchmarkController::ScheduleImplBenchmarks(
LayerTreeHostImpl* host_impl) {
- for (ScopedPtrVector<MicroBenchmark>::iterator it = benchmarks_.begin();
- it != benchmarks_.end();
- ++it) {
+ for (std::vector<scoped_ptr<MicroBenchmark>>::iterator it =
+ benchmarks_.begin();
+ it != benchmarks_.end(); ++it) {
scoped_ptr<MicroBenchmarkImpl> benchmark_impl;
if (!(*it)->ProcessedForBenchmarkImpl()) {
benchmark_impl = (*it)->GetBenchmarkImpl(main_controller_task_runner_);
@@ -110,9 +100,9 @@ void MicroBenchmarkController::ScheduleImplBenchmarks(
}
void MicroBenchmarkController::DidUpdateLayers() {
- for (ScopedPtrVector<MicroBenchmark>::iterator it = benchmarks_.begin();
- it != benchmarks_.end();
- ++it) {
+ for (std::vector<scoped_ptr<MicroBenchmark>>::iterator it =
+ benchmarks_.begin();
+ it != benchmarks_.end(); ++it) {
if (!(*it)->IsDone())
(*it)->DidUpdateLayers(host_);
}
@@ -122,7 +112,10 @@ void MicroBenchmarkController::DidUpdateLayers() {
void MicroBenchmarkController::CleanUpFinishedBenchmarks() {
benchmarks_.erase(
- benchmarks_.partition(std::not1(IsDonePredicate())),
+ std::remove_if(benchmarks_.begin(), benchmarks_.end(),
+ [](const scoped_ptr<MicroBenchmark>& benchmark) {
+ return benchmark->IsDone();
danakj 2015/11/17 01:12:16 do you mean !IsDone?
vmpstr 2015/11/17 23:26:23 No, this should remove things that are done. The c
+ }),
benchmarks_.end());
}

Powered by Google App Engine
This is Rietveld 408576698