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.
5 #ifndef CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_
6 #define CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_
12 #include "base/memory/weak_ptr.h"
13 #include "base/time/time.h"
14 #include "cc/debug/micro_benchmark_controller.h"
17 class DictionaryValue
;
24 class RasterizeAndRecordBenchmark
: public MicroBenchmark
{
26 explicit RasterizeAndRecordBenchmark(
27 scoped_ptr
<base::Value
> value
,
28 const MicroBenchmark::DoneCallback
& callback
);
29 virtual ~RasterizeAndRecordBenchmark();
31 // Implements MicroBenchmark interface.
32 virtual void DidUpdateLayers(LayerTreeHost
* host
) OVERRIDE
;
33 virtual void RunOnLayer(PictureLayer
* layer
) OVERRIDE
;
35 virtual scoped_ptr
<MicroBenchmarkImpl
> CreateBenchmarkImpl(
36 scoped_refptr
<base::MessageLoopProxy
> origin_loop
) OVERRIDE
;
39 void Run(Layer
* layer
);
41 void RecordRasterResults(scoped_ptr
<base::Value
> results
);
43 struct RecordResults
{
48 base::TimeDelta total_best_time
;
51 RecordResults record_results_
;
52 int record_repeat_count_
;
53 scoped_ptr
<base::Value
> settings_
;
54 scoped_ptr
<base::DictionaryValue
> results_
;
56 // The following is used in DCHECKs.
57 bool main_thread_benchmark_done_
;
61 base::WeakPtrFactory
<RasterizeAndRecordBenchmark
> weak_ptr_factory_
;
66 #endif // CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_