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"
15 #include "cc/resources/picture.h"
18 class DictionaryValue
;
25 class RasterizeAndRecordBenchmark
: public MicroBenchmark
{
27 explicit RasterizeAndRecordBenchmark(
28 scoped_ptr
<base::Value
> value
,
29 const MicroBenchmark::DoneCallback
& callback
);
30 ~RasterizeAndRecordBenchmark() override
;
32 // Implements MicroBenchmark interface.
33 void DidUpdateLayers(LayerTreeHost
* host
) override
;
34 void RunOnLayer(PictureLayer
* layer
) override
;
36 scoped_ptr
<MicroBenchmarkImpl
> CreateBenchmarkImpl(
37 scoped_refptr
<base::MessageLoopProxy
> origin_loop
) override
;
40 void Run(Layer
* layer
);
41 void RunOnDisplayListLayer(PictureLayer
* layer
,
42 const gfx::Rect
& visible_content_rect
);
43 void RunOnPictureLayer(PictureLayer
* layer
,
44 const gfx::Rect
& visible_content_rect
);
46 void RecordRasterResults(scoped_ptr
<base::Value
> results
);
48 struct RecordResults
{
54 base::TimeDelta total_best_time
[RecordingSource::RECORDING_MODE_COUNT
];
57 RecordResults record_results_
;
58 int record_repeat_count_
;
59 scoped_ptr
<base::Value
> settings_
;
60 scoped_ptr
<base::DictionaryValue
> results_
;
62 // The following is used in DCHECKs.
63 bool main_thread_benchmark_done_
;
67 base::WeakPtrFactory
<RasterizeAndRecordBenchmark
> weak_ptr_factory_
;
72 #endif // CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_