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..52e91aea178da2e9a9e6844a203364c1d5ac805a 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,28 @@ 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; |
+ if (!(*it)->ProcessedForBenchmarkImpl()) { |
+ benchmark_impl = |
+ (*it)->GetBenchmarkImpl(main_controller_message_loop_); |
+ } |
+ |
+ 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()) |
+ (*it)->DidUpdateLayers(host_); |
} |
CleanUpFinishedBenchmarks(); |