Chromium Code Reviews| 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" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 class Value; | 13 class Value; |
| 14 class MessageLoopProxy; | 14 class MessageLoopProxy; |
| 15 } // namespace base | 15 } // namespace base |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 | 18 |
| 19 class LayerTreeHost; | 19 class LayerTreeHost; |
| 20 class Layer; | 20 class Layer; |
| 21 class PictureLayer; | 21 class PictureLayer; |
| 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, int id); |
|
vmpstr
2014/05/28 21:16:25
Since this id isn't used by any particular benchma
ernstm
2014/05/28 21:51:55
Done. The id is now set in ScheduleRun, after the
| |
| 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_; } | |
| 32 | 33 |
| 33 virtual void RunOnLayer(Layer* layer); | 34 virtual void RunOnLayer(Layer* layer); |
| 34 virtual void RunOnLayer(PictureLayer* layer); | 35 virtual void RunOnLayer(PictureLayer* layer); |
| 35 | 36 |
| 37 virtual bool SendMessage(scoped_ptr<base::Value> value); | |
| 38 | |
| 36 bool ProcessedForBenchmarkImpl() const; | 39 bool ProcessedForBenchmarkImpl() const; |
| 37 scoped_ptr<MicroBenchmarkImpl> GetBenchmarkImpl( | 40 scoped_ptr<MicroBenchmarkImpl> GetBenchmarkImpl( |
| 38 scoped_refptr<base::MessageLoopProxy> origin_loop); | 41 scoped_refptr<base::MessageLoopProxy> origin_loop); |
| 39 | 42 |
| 40 protected: | 43 protected: |
| 41 void NotifyDone(scoped_ptr<base::Value> result); | 44 void NotifyDone(scoped_ptr<base::Value> result); |
| 42 | 45 |
| 43 virtual scoped_ptr<MicroBenchmarkImpl> CreateBenchmarkImpl( | 46 virtual scoped_ptr<MicroBenchmarkImpl> CreateBenchmarkImpl( |
| 44 scoped_refptr<base::MessageLoopProxy> origin_loop); | 47 scoped_refptr<base::MessageLoopProxy> origin_loop); |
| 45 | 48 |
| 46 private: | 49 private: |
| 47 DoneCallback callback_; | 50 DoneCallback callback_; |
| 48 bool is_done_; | 51 bool is_done_; |
| 49 bool processed_for_benchmark_impl_; | 52 bool processed_for_benchmark_impl_; |
| 53 int id_; | |
| 50 }; | 54 }; |
| 51 | 55 |
| 52 } // namespace cc | 56 } // namespace cc |
| 53 | 57 |
| 54 #endif // CC_DEBUG_MICRO_BENCHMARK_H_ | 58 #endif // CC_DEBUG_MICRO_BENCHMARK_H_ |
| OLD | NEW |