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

Unified Diff: cc/debug/micro_benchmark_controller.cc

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 months 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
« no previous file with comments | « cc/debug/micro_benchmark_controller.h ('k') | cc/debug/micro_benchmark_controller_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/debug/micro_benchmark_controller.cc
diff --git a/cc/debug/micro_benchmark_controller.cc b/cc/debug/micro_benchmark_controller.cc
index 78fa5616656606f767a4622ddbfe27da8d4d8b33..54d33c9ab19a8467beaa1e484a88c7e8d09ff4ab 100644
--- a/cc/debug/micro_benchmark_controller.cc
+++ b/cc/debug/micro_benchmark_controller.cc
@@ -8,6 +8,7 @@
#include <string>
#include "base/callback.h"
+#include "base/memory/ptr_util.h"
#include "base/thread_task_runner_handle.h"
#include "base/values.h"
#include "cc/debug/invalidation_benchmark.h"
@@ -22,18 +23,18 @@ int MicroBenchmarkController::next_id_ = 1;
namespace {
-scoped_ptr<MicroBenchmark> CreateBenchmark(
+std::unique_ptr<MicroBenchmark> CreateBenchmark(
const std::string& name,
- scoped_ptr<base::Value> value,
+ std::unique_ptr<base::Value> value,
const MicroBenchmark::DoneCallback& callback) {
if (name == "invalidation_benchmark") {
- return make_scoped_ptr(
+ return base::WrapUnique(
new InvalidationBenchmark(std::move(value), callback));
} else if (name == "rasterize_and_record_benchmark") {
- return make_scoped_ptr(
+ return base::WrapUnique(
new RasterizeAndRecordBenchmark(std::move(value), callback));
} else if (name == "unittest_only_benchmark") {
- return make_scoped_ptr(
+ return base::WrapUnique(
new UnittestOnlyBenchmark(std::move(value), callback));
}
return nullptr;
@@ -53,9 +54,9 @@ MicroBenchmarkController::~MicroBenchmarkController() {}
int MicroBenchmarkController::ScheduleRun(
const std::string& micro_benchmark_name,
- scoped_ptr<base::Value> value,
+ std::unique_ptr<base::Value> value,
const MicroBenchmark::DoneCallback& callback) {
- scoped_ptr<MicroBenchmark> benchmark =
+ std::unique_ptr<MicroBenchmark> benchmark =
CreateBenchmark(micro_benchmark_name, std::move(value), callback);
if (benchmark.get()) {
int id = GetNextIdAndIncrement();
@@ -76,11 +77,12 @@ int MicroBenchmarkController::GetNextIdAndIncrement() {
}
bool MicroBenchmarkController::SendMessage(int id,
- scoped_ptr<base::Value> value) {
- auto it = std::find_if(benchmarks_.begin(), benchmarks_.end(),
- [id](const scoped_ptr<MicroBenchmark>& benchmark) {
- return benchmark->id() == id;
- });
+ std::unique_ptr<base::Value> value) {
+ auto it =
+ std::find_if(benchmarks_.begin(), benchmarks_.end(),
+ [id](const std::unique_ptr<MicroBenchmark>& benchmark) {
+ return benchmark->id() == id;
+ });
if (it == benchmarks_.end())
return false;
return (*it)->ProcessMessage(std::move(value));
@@ -89,7 +91,7 @@ bool MicroBenchmarkController::SendMessage(int id,
void MicroBenchmarkController::ScheduleImplBenchmarks(
LayerTreeHostImpl* host_impl) {
for (const auto& benchmark : benchmarks_) {
- scoped_ptr<MicroBenchmarkImpl> benchmark_impl;
+ std::unique_ptr<MicroBenchmarkImpl> benchmark_impl;
if (!benchmark->ProcessedForBenchmarkImpl()) {
benchmark_impl =
benchmark->GetBenchmarkImpl(main_controller_task_runner_);
@@ -112,7 +114,7 @@ void MicroBenchmarkController::DidUpdateLayers() {
void MicroBenchmarkController::CleanUpFinishedBenchmarks() {
benchmarks_.erase(
std::remove_if(benchmarks_.begin(), benchmarks_.end(),
- [](const scoped_ptr<MicroBenchmark>& benchmark) {
+ [](const std::unique_ptr<MicroBenchmark>& benchmark) {
return benchmark->IsDone();
}),
benchmarks_.end());
« no previous file with comments | « cc/debug/micro_benchmark_controller.h ('k') | cc/debug/micro_benchmark_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698