| 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 LayerTree; | 26 class LayerTreeHost; |
| 27 | 27 |
| 28 class RasterizeAndRecordBenchmark : public MicroBenchmark { | 28 class RasterizeAndRecordBenchmark : public MicroBenchmark { |
| 29 public: | 29 public: |
| 30 explicit RasterizeAndRecordBenchmark( | 30 explicit RasterizeAndRecordBenchmark( |
| 31 std::unique_ptr<base::Value> value, | 31 std::unique_ptr<base::Value> value, |
| 32 const MicroBenchmark::DoneCallback& callback); | 32 const MicroBenchmark::DoneCallback& callback); |
| 33 ~RasterizeAndRecordBenchmark() override; | 33 ~RasterizeAndRecordBenchmark() override; |
| 34 | 34 |
| 35 // Implements MicroBenchmark interface. | 35 // Implements MicroBenchmark interface. |
| 36 void DidUpdateLayers(LayerTree* layer_tree) override; | 36 void DidUpdateLayers(LayerTreeHost* layer_tree_host) override; |
| 37 void RunOnLayer(PictureLayer* layer) override; | 37 void RunOnLayer(PictureLayer* layer) override; |
| 38 | 38 |
| 39 std::unique_ptr<MicroBenchmarkImpl> CreateBenchmarkImpl( | 39 std::unique_ptr<MicroBenchmarkImpl> CreateBenchmarkImpl( |
| 40 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner) override; | 40 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner) override; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 void RecordRasterResults(std::unique_ptr<base::Value> results); | 43 void RecordRasterResults(std::unique_ptr<base::Value> results); |
| 44 | 44 |
| 45 struct RecordResults { | 45 struct RecordResults { |
| 46 RecordResults(); | 46 RecordResults(); |
| 47 ~RecordResults(); | 47 ~RecordResults(); |
| 48 | 48 |
| 49 int pixels_recorded; | 49 int pixels_recorded; |
| 50 size_t bytes_used; | 50 size_t bytes_used; |
| 51 base::TimeDelta total_best_time[RecordingSource::RECORDING_MODE_COUNT]; | 51 base::TimeDelta total_best_time[RecordingSource::RECORDING_MODE_COUNT]; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 RecordResults record_results_; | 54 RecordResults record_results_; |
| 55 int record_repeat_count_; | 55 int record_repeat_count_; |
| 56 std::unique_ptr<base::Value> settings_; | 56 std::unique_ptr<base::Value> settings_; |
| 57 std::unique_ptr<base::DictionaryValue> results_; | 57 std::unique_ptr<base::DictionaryValue> results_; |
| 58 | 58 |
| 59 // The following is used in DCHECKs. | 59 // The following is used in DCHECKs. |
| 60 bool main_thread_benchmark_done_; | 60 bool main_thread_benchmark_done_; |
| 61 | 61 |
| 62 LayerTree* layer_tree_; | 62 LayerTreeHost* layer_tree_host_; |
| 63 | 63 |
| 64 base::WeakPtrFactory<RasterizeAndRecordBenchmark> weak_ptr_factory_; | 64 base::WeakPtrFactory<RasterizeAndRecordBenchmark> weak_ptr_factory_; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 } // namespace cc | 67 } // namespace cc |
| 68 | 68 |
| 69 #endif // CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_ | 69 #endif // CC_DEBUG_RASTERIZE_AND_RECORD_BENCHMARK_H_ |
| OLD | NEW |