// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_ #define CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_ #include #include #include #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "cc/debug/micro_benchmark_controller.h" #include "cc/resources/picture.h" namespace base { class DictionaryValue; } namespace cc { class LayerTreeHost; class Layer; class RasterizeAndRecordBenchmark : public MicroBenchmark { public: explicit RasterizeAndRecordBenchmark( scoped_ptr value, const MicroBenchmark::DoneCallback& callback); virtual ~RasterizeAndRecordBenchmark(); // Implements MicroBenchmark interface. virtual void DidUpdateLayers(LayerTreeHost* host) OVERRIDE; virtual void RunOnLayer(PictureLayer* layer) OVERRIDE; virtual scoped_ptr CreateBenchmarkImpl( scoped_refptr origin_loop) OVERRIDE; private: void Run(Layer* layer); void RecordRasterResults(scoped_ptr results); struct RecordResults { RecordResults(); ~RecordResults(); int pixels_recorded; base::TimeDelta total_best_time[Picture::RECORDING_MODE_COUNT]; }; RecordResults record_results_; int record_repeat_count_; scoped_ptr settings_; scoped_ptr results_; // The following is used in DCHECKs. bool main_thread_benchmark_done_; LayerTreeHost* host_; base::WeakPtrFactory weak_ptr_factory_; }; } // namespace cc #endif // CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_