| 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" |
| 11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "cc/debug/invalidation_benchmark.h" |
| 13 #include "cc/debug/picture_record_benchmark.h" | 14 #include "cc/debug/picture_record_benchmark.h" |
| 14 #include "cc/debug/rasterize_and_record_benchmark.h" | 15 #include "cc/debug/rasterize_and_record_benchmark.h" |
| 15 #include "cc/debug/unittest_only_benchmark.h" | 16 #include "cc/debug/unittest_only_benchmark.h" |
| 16 #include "cc/trees/layer_tree_host.h" | 17 #include "cc/trees/layer_tree_host.h" |
| 17 #include "cc/trees/layer_tree_host_impl.h" | 18 #include "cc/trees/layer_tree_host_impl.h" |
| 18 | 19 |
| 19 namespace cc { | 20 namespace cc { |
| 20 | 21 |
| 21 int MicroBenchmarkController::next_id_ = 1; | 22 int MicroBenchmarkController::next_id_ = 1; |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 scoped_ptr<MicroBenchmark> CreateBenchmark( | 26 scoped_ptr<MicroBenchmark> CreateBenchmark( |
| 26 const std::string& name, | 27 const std::string& name, |
| 27 scoped_ptr<base::Value> value, | 28 scoped_ptr<base::Value> value, |
| 28 const MicroBenchmark::DoneCallback& callback) { | 29 const MicroBenchmark::DoneCallback& callback) { |
| 29 if (name == "picture_record_benchmark") { | 30 if (name == "invalidation_benchmark") { |
| 31 return scoped_ptr<MicroBenchmark>( |
| 32 new InvalidationBenchmark(value.Pass(), callback)); |
| 33 } else if (name == "picture_record_benchmark") { |
| 30 return scoped_ptr<MicroBenchmark>( | 34 return scoped_ptr<MicroBenchmark>( |
| 31 new PictureRecordBenchmark(value.Pass(), callback)); | 35 new PictureRecordBenchmark(value.Pass(), callback)); |
| 32 } else if (name == "rasterize_and_record_benchmark") { | 36 } else if (name == "rasterize_and_record_benchmark") { |
| 33 return scoped_ptr<MicroBenchmark>( | 37 return scoped_ptr<MicroBenchmark>( |
| 34 new RasterizeAndRecordBenchmark(value.Pass(), callback)); | 38 new RasterizeAndRecordBenchmark(value.Pass(), callback)); |
| 35 } else if (name == "unittest_only_benchmark") { | 39 } else if (name == "unittest_only_benchmark") { |
| 36 return scoped_ptr<MicroBenchmark>( | 40 return scoped_ptr<MicroBenchmark>( |
| 37 new UnittestOnlyBenchmark(value.Pass(), callback)); | 41 new UnittestOnlyBenchmark(value.Pass(), callback)); |
| 38 } | 42 } |
| 39 return scoped_ptr<MicroBenchmark>(); | 43 return scoped_ptr<MicroBenchmark>(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 CleanUpFinishedBenchmarks(); | 125 CleanUpFinishedBenchmarks(); |
| 122 } | 126 } |
| 123 | 127 |
| 124 void MicroBenchmarkController::CleanUpFinishedBenchmarks() { | 128 void MicroBenchmarkController::CleanUpFinishedBenchmarks() { |
| 125 benchmarks_.erase( | 129 benchmarks_.erase( |
| 126 benchmarks_.partition(std::not1(IsDonePredicate())), | 130 benchmarks_.partition(std::not1(IsDonePredicate())), |
| 127 benchmarks_.end()); | 131 benchmarks_.end()); |
| 128 } | 132 } |
| 129 | 133 |
| 130 } // namespace cc | 134 } // namespace cc |
| OLD | NEW |