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

Side by Side Diff: cc/debug/micro_benchmark_controller.cc

Issue 2258833002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « cc/blink/web_content_layer_impl.cc ('k') | cc/debug/micro_benchmark_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/debug/micro_benchmark_controller.h" 5 #include "cc/debug/micro_benchmark_controller.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 10 matching lines...) Expand all
21 21
22 int MicroBenchmarkController::next_id_ = 1; 22 int MicroBenchmarkController::next_id_ = 1;
23 23
24 namespace { 24 namespace {
25 25
26 std::unique_ptr<MicroBenchmark> CreateBenchmark( 26 std::unique_ptr<MicroBenchmark> CreateBenchmark(
27 const std::string& name, 27 const std::string& name,
28 std::unique_ptr<base::Value> value, 28 std::unique_ptr<base::Value> value,
29 const MicroBenchmark::DoneCallback& callback) { 29 const MicroBenchmark::DoneCallback& callback) {
30 if (name == "invalidation_benchmark") { 30 if (name == "invalidation_benchmark") {
31 return base::WrapUnique( 31 return base::MakeUnique<InvalidationBenchmark>(std::move(value), callback);
32 new InvalidationBenchmark(std::move(value), callback));
33 } else if (name == "rasterize_and_record_benchmark") { 32 } else if (name == "rasterize_and_record_benchmark") {
34 return base::WrapUnique( 33 return base::MakeUnique<RasterizeAndRecordBenchmark>(std::move(value),
35 new RasterizeAndRecordBenchmark(std::move(value), callback)); 34 callback);
36 } else if (name == "unittest_only_benchmark") { 35 } else if (name == "unittest_only_benchmark") {
37 return base::WrapUnique( 36 return base::MakeUnique<UnittestOnlyBenchmark>(std::move(value), callback);
38 new UnittestOnlyBenchmark(std::move(value), callback));
39 } 37 }
40 return nullptr; 38 return nullptr;
41 } 39 }
42 40
43 } // namespace 41 } // namespace
44 42
45 MicroBenchmarkController::MicroBenchmarkController(LayerTreeHost* host) 43 MicroBenchmarkController::MicroBenchmarkController(LayerTreeHost* host)
46 : host_(host), 44 : host_(host),
47 main_controller_task_runner_(base::ThreadTaskRunnerHandle::IsSet() 45 main_controller_task_runner_(base::ThreadTaskRunnerHandle::IsSet()
48 ? base::ThreadTaskRunnerHandle::Get() 46 ? base::ThreadTaskRunnerHandle::Get()
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 void MicroBenchmarkController::CleanUpFinishedBenchmarks() { 112 void MicroBenchmarkController::CleanUpFinishedBenchmarks() {
115 benchmarks_.erase( 113 benchmarks_.erase(
116 std::remove_if(benchmarks_.begin(), benchmarks_.end(), 114 std::remove_if(benchmarks_.begin(), benchmarks_.end(),
117 [](const std::unique_ptr<MicroBenchmark>& benchmark) { 115 [](const std::unique_ptr<MicroBenchmark>& benchmark) {
118 return benchmark->IsDone(); 116 return benchmark->IsDone();
119 }), 117 }),
120 benchmarks_.end()); 118 benchmarks_.end());
121 } 119 }
122 120
123 } // namespace cc 121 } // namespace cc
OLDNEW
« no previous file with comments | « cc/blink/web_content_layer_impl.cc ('k') | cc/debug/micro_benchmark_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698