Add git cl format presubmit warning for extension and apps.
[chromium-blink-merge.git] / cc / debug / rasterize_and_record_benchmark.h
blob2cea16a2f4e6838a81f6153462159a7338dc38c8
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_
8 #include <map>
9 #include <utility>
10 #include <vector>
12 #include "base/memory/weak_ptr.h"
13 #include "base/time/time.h"
14 #include "cc/debug/micro_benchmark_controller.h"
16 namespace base {
17 class DictionaryValue;
20 namespace cc {
22 class LayerTreeHost;
23 class Layer;
24 class RasterizeAndRecordBenchmark : public MicroBenchmark {
25 public:
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;
38 private:
39 void Run(Layer* layer);
41 void RecordRasterResults(scoped_ptr<base::Value> results);
43 struct RecordResults {
44 RecordResults();
45 ~RecordResults();
47 int pixels_recorded;
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_;
59 LayerTreeHost* host_;
61 base::WeakPtrFactory<RasterizeAndRecordBenchmark> weak_ptr_factory_;
64 } // namespace cc
66 #endif // CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_