Chromium Code Reviews| Index: cc/debug/micro_benchmark_controller.cc |
| diff --git a/cc/debug/micro_benchmark_controller.cc b/cc/debug/micro_benchmark_controller.cc |
| index 6e34e481698a0b0e7055848f7032153e5a2a932f..23e81e6ca9bc494fd8e06d318c7140f791ce068a 100644 |
| --- a/cc/debug/micro_benchmark_controller.cc |
| +++ b/cc/debug/micro_benchmark_controller.cc |
| @@ -7,10 +7,12 @@ |
| #include <string> |
| #include "base/callback.h" |
| +#include "base/message_loop/message_loop_proxy.h" |
| #include "base/values.h" |
| #include "cc/debug/picture_record_benchmark.h" |
| #include "cc/debug/unittest_only_benchmark.h" |
| #include "cc/trees/layer_tree_host.h" |
| +#include "cc/trees/layer_tree_host_impl.h" |
| namespace cc { |
| @@ -43,7 +45,8 @@ class IsDonePredicate { |
| } // namespace |
| MicroBenchmarkController::MicroBenchmarkController(LayerTreeHost* host) |
| - : host_(host) { |
| + : host_(host), |
| + main_controller_message_loop_(base::MessageLoopProxy::current().get()) { |
| DCHECK(host_); |
| } |
| @@ -63,12 +66,24 @@ bool MicroBenchmarkController::ScheduleRun( |
| return false; |
| } |
| +void MicroBenchmarkController::ScheduleImplBenchmarks( |
| + LayerTreeHostImpl* host_impl) { |
| + for (ScopedPtrVector<MicroBenchmark>::iterator it = benchmarks_.begin(); |
| + it != benchmarks_.end(); |
| + ++it) { |
| + scoped_ptr<MicroBenchmarkImpl> benchmark_impl = |
| + (*it)->CreateBenchmarkImpl(main_controller_message_loop_); |
|
enne (OOO)
2013/11/12 01:09:36
So if you have a MicroBenchmarkImpl that doesn't c
vmpstr
2013/11/12 17:51:38
That's a good point. I mean it _could_ happen that
enne (OOO)
2013/11/12 19:22:56
Yeah, I'm not sure what the right thing to do here
vmpstr
2013/11/12 20:20:38
I went with just keeping the state in the microben
|
| + if (benchmark_impl.get()) |
| + host_impl->ScheduleMicroBenchmark(benchmark_impl.Pass()); |
| + } |
| +} |
| + |
| void MicroBenchmarkController::DidUpdateLayers() { |
| for (ScopedPtrVector<MicroBenchmark>::iterator it = benchmarks_.begin(); |
| it != benchmarks_.end(); |
| ++it) { |
| - DCHECK(!(*it)->IsDone()); |
| - (*it)->DidUpdateLayers(host_); |
| + if (!(*it)->IsDone()) |
|
vmpstr
2013/11/09 00:41:41
If the main thread benchmark was waiting for the i
|
| + (*it)->DidUpdateLayers(host_); |
| } |
| CleanUpFinishedBenchmarks(); |