| 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_RASTERIZE_AND_RECORD_BENCHMARK_H_ | 5 #ifndef CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_ |
| 6 #define CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_ | 6 #define CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "cc/debug/micro_benchmark_controller.h" | 17 #include "cc/debug/micro_benchmark_controller.h" |
| 18 #include "cc/playback/recording_source.h" | 18 #include "cc/playback/recording_source.h" |
| 19 | 19 |
| 20 namespace base { | 20 namespace base { |
| 21 class DictionaryValue; | 21 class DictionaryValue; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace cc { | 24 namespace cc { |
| 25 | 25 |
| 26 class LayerTreeHost; | 26 class LayerTree; |
| 27 class Layer; | 27 class Layer; |
| 28 | 28 |
| 29 class RasterizeAndRecordBenchmark : public MicroBenchmark { | 29 class RasterizeAndRecordBenchmark : public MicroBenchmark { |
| 30 public: | 30 public: |
| 31 explicit RasterizeAndRecordBenchmark( | 31 explicit RasterizeAndRecordBenchmark( |
| 32 std::unique_ptr<base::Value> value, | 32 std::unique_ptr<base::Value> value, |
| 33 const MicroBenchmark::DoneCallback& callback); | 33 const MicroBenchmark::DoneCallback& callback); |
| 34 ~RasterizeAndRecordBenchmark() override; | 34 ~RasterizeAndRecordBenchmark() override; |
| 35 | 35 |
| 36 // Implements MicroBenchmark interface. | 36 // Implements MicroBenchmark interface. |
| 37 void DidUpdateLayers(LayerTreeHost* host) override; | 37 void DidUpdateLayers(LayerTree* layer_tree) override; |
| 38 void RunOnLayer(PictureLayer* layer) override; | 38 void RunOnLayer(PictureLayer* layer) override; |
| 39 | 39 |
| 40 std::unique_ptr<MicroBenchmarkImpl> CreateBenchmarkImpl( | 40 std::unique_ptr<MicroBenchmarkImpl> CreateBenchmarkImpl( |
| 41 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner) override; | 41 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner) override; |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 void RecordRasterResults(std::unique_ptr<base::Value> results); | 44 void RecordRasterResults(std::unique_ptr<base::Value> results); |
| 45 | 45 |
| 46 struct RecordResults { | 46 struct RecordResults { |
| 47 RecordResults(); | 47 RecordResults(); |
| 48 ~RecordResults(); | 48 ~RecordResults(); |
| 49 | 49 |
| 50 int pixels_recorded; | 50 int pixels_recorded; |
| 51 size_t bytes_used; | 51 size_t bytes_used; |
| 52 base::TimeDelta total_best_time[RecordingSource::RECORDING_MODE_COUNT]; | 52 base::TimeDelta total_best_time[RecordingSource::RECORDING_MODE_COUNT]; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 RecordResults record_results_; | 55 RecordResults record_results_; |
| 56 int record_repeat_count_; | 56 int record_repeat_count_; |
| 57 std::unique_ptr<base::Value> settings_; | 57 std::unique_ptr<base::Value> settings_; |
| 58 std::unique_ptr<base::DictionaryValue> results_; | 58 std::unique_ptr<base::DictionaryValue> results_; |
| 59 | 59 |
| 60 // The following is used in DCHECKs. | 60 // The following is used in DCHECKs. |
| 61 bool main_thread_benchmark_done_; | 61 bool main_thread_benchmark_done_; |
| 62 | 62 |
| 63 LayerTreeHost* host_; | 63 LayerTree* layer_tree_; |
| 64 | 64 |
| 65 base::WeakPtrFactory<RasterizeAndRecordBenchmark> weak_ptr_factory_; | 65 base::WeakPtrFactory<RasterizeAndRecordBenchmark> weak_ptr_factory_; |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 } // namespace cc | 68 } // namespace cc |
| 69 | 69 |
| 70 #endif // CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_ | 70 #endif // CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_ |
| OLD | NEW |