| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |