| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "cc/debug/invalidation_benchmark.h" |
| 12 #include "cc/debug/picture_record_benchmark.h" | 13 #include "cc/debug/picture_record_benchmark.h" |
| 13 #include "cc/debug/rasterize_and_record_benchmark.h" | 14 #include "cc/debug/rasterize_and_record_benchmark.h" |
| 14 #include "cc/debug/unittest_only_benchmark.h" | 15 #include "cc/debug/unittest_only_benchmark.h" |
| 15 #include "cc/trees/layer_tree_host.h" | 16 #include "cc/trees/layer_tree_host.h" |
| 16 #include "cc/trees/layer_tree_host_impl.h" | 17 #include "cc/trees/layer_tree_host_impl.h" |
| 17 | 18 |
| 18 namespace cc { | 19 namespace cc { |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 scoped_ptr<MicroBenchmark> CreateBenchmark( | 23 scoped_ptr<MicroBenchmark> CreateBenchmark( |
| 23 const std::string& name, | 24 const std::string& name, |
| 24 scoped_ptr<base::Value> value, | 25 scoped_ptr<base::Value> value, |
| 25 const MicroBenchmark::DoneCallback& callback) { | 26 const MicroBenchmark::DoneCallback& callback) { |
| 26 if (name == "picture_record_benchmark") { | 27 if (name == "invalidation_benchmark") { |
| 28 return scoped_ptr<MicroBenchmark>( |
| 29 new InvalidationBenchmark(value.Pass(), callback)); |
| 30 } else if (name == "picture_record_benchmark") { |
| 27 return scoped_ptr<MicroBenchmark>( | 31 return scoped_ptr<MicroBenchmark>( |
| 28 new PictureRecordBenchmark(value.Pass(), callback)); | 32 new PictureRecordBenchmark(value.Pass(), callback)); |
| 29 } else if (name == "rasterize_and_record_benchmark") { | 33 } else if (name == "rasterize_and_record_benchmark") { |
| 30 return scoped_ptr<MicroBenchmark>( | 34 return scoped_ptr<MicroBenchmark>( |
| 31 new RasterizeAndRecordBenchmark(value.Pass(), callback)); | 35 new RasterizeAndRecordBenchmark(value.Pass(), callback)); |
| 32 } else if (name == "unittest_only_benchmark") { | 36 } else if (name == "unittest_only_benchmark") { |
| 33 return scoped_ptr<MicroBenchmark>( | 37 return scoped_ptr<MicroBenchmark>( |
| 34 new UnittestOnlyBenchmark(value.Pass(), callback)); | 38 new UnittestOnlyBenchmark(value.Pass(), callback)); |
| 35 } | 39 } |
| 36 return scoped_ptr<MicroBenchmark>(); | 40 return scoped_ptr<MicroBenchmark>(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 CleanUpFinishedBenchmarks(); | 101 CleanUpFinishedBenchmarks(); |
| 98 } | 102 } |
| 99 | 103 |
| 100 void MicroBenchmarkController::CleanUpFinishedBenchmarks() { | 104 void MicroBenchmarkController::CleanUpFinishedBenchmarks() { |
| 101 benchmarks_.erase( | 105 benchmarks_.erase( |
| 102 benchmarks_.partition(std::not1(IsDonePredicate())), | 106 benchmarks_.partition(std::not1(IsDonePredicate())), |
| 103 benchmarks_.end()); | 107 benchmarks_.end()); |
| 104 } | 108 } |
| 105 | 109 |
| 106 } // namespace cc | 110 } // namespace cc |
| OLD | NEW |