micro_benchmark_controller.h revision f2477e01787aa58f445919b809d89e252beef54f
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 3// found in the LICENSE file. 4 5#ifndef CC_DEBUG_MICRO_BENCHMARK_CONTROLLER_H_ 6#define CC_DEBUG_MICRO_BENCHMARK_CONTROLLER_H_ 7 8#include <string> 9 10#include "base/basictypes.h" 11#include "base/callback.h" 12#include "cc/base/scoped_ptr_vector.h" 13#include "cc/debug/micro_benchmark.h" 14 15namespace base { 16class Value; 17class MessageLoopProxy; 18} // namespace base 19 20namespace cc { 21 22class LayerTreeHost; 23class LayerTreeHostImpl; 24class CC_EXPORT MicroBenchmarkController { 25 public: 26 explicit MicroBenchmarkController(LayerTreeHost* host); 27 ~MicroBenchmarkController(); 28 29 void DidUpdateLayers(); 30 31 bool ScheduleRun(const std::string& micro_benchmark_name, 32 scoped_ptr<base::Value> value, 33 const MicroBenchmark::DoneCallback& callback); 34 35 void ScheduleImplBenchmarks(LayerTreeHostImpl* host_impl); 36 37 private: 38 void CleanUpFinishedBenchmarks(); 39 40 LayerTreeHost* host_; 41 ScopedPtrVector<MicroBenchmark> benchmarks_; 42 scoped_refptr<base::MessageLoopProxy> main_controller_message_loop_; 43 44 DISALLOW_COPY_AND_ASSIGN(MicroBenchmarkController); 45}; 46 47} // namespace cc 48 49#endif // CC_DEBUG_MICRO_BENCHMARK_CONTROLLER_H_ 50