Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(624)

Side by Side Diff: cc/debug/rasterize_and_record_benchmark.h

Issue 66213007: cc: Add rasterize and record micro benchmark. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added weak ptrs Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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_RASTERIZE_AND_RECORD_BENCHMARK_H_
6 #define CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_
7
8 #include <map>
9 #include <utility>
10 #include <vector>
11
12 #include "base/memory/weak_ptr.h"
13 #include "base/time/time.h"
14 #include "cc/debug/micro_benchmark_controller.h"
15
16 namespace base {
17 class DictionaryValue;
18 }
19
20 namespace cc {
21
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();
30
31 // Implements MicroBenchmark interface.
32 virtual void DidUpdateLayers(LayerTreeHost* host) OVERRIDE;
33 virtual void RunOnLayer(PictureLayer* layer) OVERRIDE;
34
35 virtual scoped_ptr<MicroBenchmarkImpl> CreateBenchmarkImpl(
36 scoped_refptr<base::MessageLoopProxy> origin_loop) OVERRIDE;
37
38 private:
39 void Run(Layer* layer);
40
41 void RecordRasterResults(scoped_ptr<base::Value> results);
42
43 struct RecordResults {
44 RecordResults();
45 ~RecordResults();
46
47 int pixels_recorded;
48 base::TimeDelta total_best_time;
49 };
50
51 RecordResults record_results_;
52 int record_repeat_count_;
53 scoped_ptr<base::Value> settings_;
54 scoped_ptr<base::DictionaryValue> results_;
55
56 // The following is used in DCHECKs.
57 bool main_thread_benchmark_done_;
58
59 base::WeakPtrFactory<RasterizeAndRecordBenchmark> weak_ptr_factory_;
enne (OOO) 2013/11/14 00:24:05 It's a little sad to me that each derived benchmar
vmpstr 2013/11/14 19:38:24 I'll see if I can make this better in a follow-up
60 };
61
62 } // namespace cc
63
64 #endif // CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698