| 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 | 11 |
| 11 namespace base { | 12 namespace base { |
| 12 class Value; | 13 class Value; |
| 14 class MessageLoopProxy; |
| 13 } // namespace base | 15 } // namespace base |
| 14 | 16 |
| 15 namespace cc { | 17 namespace cc { |
| 16 | 18 |
| 17 class LayerTreeHost; | 19 class LayerTreeHost; |
| 18 class Layer; | 20 class Layer; |
| 19 class PictureLayer; | 21 class PictureLayer; |
| 20 class MicroBenchmark { | 22 class MicroBenchmarkImpl; |
| 23 class CC_EXPORT MicroBenchmark { |
| 21 public: | 24 public: |
| 22 typedef base::Callback<void(scoped_ptr<base::Value>)> DoneCallback; | 25 typedef base::Callback<void(scoped_ptr<base::Value>)> DoneCallback; |
| 23 | 26 |
| 24 explicit MicroBenchmark(const DoneCallback& callback); | 27 explicit MicroBenchmark(const DoneCallback& callback); |
| 25 virtual ~MicroBenchmark(); | 28 virtual ~MicroBenchmark(); |
| 26 | 29 |
| 27 bool IsDone() const; | 30 bool IsDone() const; |
| 28 virtual void DidUpdateLayers(LayerTreeHost* host); | 31 virtual void DidUpdateLayers(LayerTreeHost* host); |
| 29 | 32 |
| 30 virtual void RunOnLayer(Layer* layer); | 33 virtual void RunOnLayer(Layer* layer); |
| 31 virtual void RunOnLayer(PictureLayer* layer); | 34 virtual void RunOnLayer(PictureLayer* layer); |
| 32 | 35 |
| 36 bool ProcessedForBenchmarkImpl() const; |
| 37 scoped_ptr<MicroBenchmarkImpl> GetBenchmarkImpl( |
| 38 scoped_refptr<base::MessageLoopProxy> origin_loop); |
| 39 |
| 33 protected: | 40 protected: |
| 34 void NotifyDone(scoped_ptr<base::Value> result); | 41 void NotifyDone(scoped_ptr<base::Value> result); |
| 35 | 42 |
| 43 virtual scoped_ptr<MicroBenchmarkImpl> CreateBenchmarkImpl( |
| 44 scoped_refptr<base::MessageLoopProxy> origin_loop); |
| 45 |
| 36 private: | 46 private: |
| 37 DoneCallback callback_; | 47 DoneCallback callback_; |
| 38 bool is_done_; | 48 bool is_done_; |
| 49 bool processed_for_benchmark_impl_; |
| 39 }; | 50 }; |
| 40 | 51 |
| 41 } // namespace cc | 52 } // namespace cc |
| 42 | 53 |
| 43 #endif // CC_DEBUG_MICRO_BENCHMARK_H_ | 54 #endif // CC_DEBUG_MICRO_BENCHMARK_H_ |
| OLD | NEW |