OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_DEBUG_MICRO_BENCHMARK_H_ | 5 #ifndef CC_DEBUG_MICRO_BENCHMARK_H_ |
6 #define CC_DEBUG_MICRO_BENCHMARK_H_ | 6 #define CC_DEBUG_MICRO_BENCHMARK_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class MicroBenchmarkImpl; | 22 class MicroBenchmarkImpl; |
23 class CC_EXPORT MicroBenchmark { | 23 class CC_EXPORT MicroBenchmark { |
24 public: | 24 public: |
25 typedef base::Callback<void(scoped_ptr<base::Value>)> DoneCallback; | 25 typedef base::Callback<void(scoped_ptr<base::Value>)> DoneCallback; |
26 | 26 |
27 explicit MicroBenchmark(const DoneCallback& callback); | 27 explicit MicroBenchmark(const DoneCallback& callback); |
28 virtual ~MicroBenchmark(); | 28 virtual ~MicroBenchmark(); |
29 | 29 |
30 bool IsDone() const; | 30 bool IsDone() const; |
31 virtual void DidUpdateLayers(LayerTreeHost* host); | 31 virtual void DidUpdateLayers(LayerTreeHost* host); |
| 32 int id() const { return id_; } |
| 33 void set_id(int id) { id_ = id; } |
32 | 34 |
33 virtual void RunOnLayer(Layer* layer); | 35 virtual void RunOnLayer(Layer* layer); |
34 virtual void RunOnLayer(PictureLayer* layer); | 36 virtual void RunOnLayer(PictureLayer* layer); |
35 | 37 |
| 38 virtual bool ProcessMessage(scoped_ptr<base::Value> value); |
| 39 |
36 bool ProcessedForBenchmarkImpl() const; | 40 bool ProcessedForBenchmarkImpl() const; |
37 scoped_ptr<MicroBenchmarkImpl> GetBenchmarkImpl( | 41 scoped_ptr<MicroBenchmarkImpl> GetBenchmarkImpl( |
38 scoped_refptr<base::MessageLoopProxy> origin_loop); | 42 scoped_refptr<base::MessageLoopProxy> origin_loop); |
39 | 43 |
40 protected: | 44 protected: |
41 void NotifyDone(scoped_ptr<base::Value> result); | 45 void NotifyDone(scoped_ptr<base::Value> result); |
42 | 46 |
43 virtual scoped_ptr<MicroBenchmarkImpl> CreateBenchmarkImpl( | 47 virtual scoped_ptr<MicroBenchmarkImpl> CreateBenchmarkImpl( |
44 scoped_refptr<base::MessageLoopProxy> origin_loop); | 48 scoped_refptr<base::MessageLoopProxy> origin_loop); |
45 | 49 |
46 private: | 50 private: |
47 DoneCallback callback_; | 51 DoneCallback callback_; |
48 bool is_done_; | 52 bool is_done_; |
49 bool processed_for_benchmark_impl_; | 53 bool processed_for_benchmark_impl_; |
| 54 int id_; |
50 }; | 55 }; |
51 | 56 |
52 } // namespace cc | 57 } // namespace cc |
53 | 58 |
54 #endif // CC_DEBUG_MICRO_BENCHMARK_H_ | 59 #endif // CC_DEBUG_MICRO_BENCHMARK_H_ |
OLD | NEW |