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_CONTROLLER_H_ | 5 #ifndef CC_DEBUG_MICRO_BENCHMARK_CONTROLLER_H_ |
6 #define CC_DEBUG_MICRO_BENCHMARK_CONTROLLER_H_ | 6 #define CC_DEBUG_MICRO_BENCHMARK_CONTROLLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 class LayerTreeHost; | 22 class LayerTreeHost; |
23 class LayerTreeHostImpl; | 23 class LayerTreeHostImpl; |
24 class CC_EXPORT MicroBenchmarkController { | 24 class CC_EXPORT MicroBenchmarkController { |
25 public: | 25 public: |
26 explicit MicroBenchmarkController(LayerTreeHost* host); | 26 explicit MicroBenchmarkController(LayerTreeHost* host); |
27 ~MicroBenchmarkController(); | 27 ~MicroBenchmarkController(); |
28 | 28 |
29 void DidUpdateLayers(); | 29 void DidUpdateLayers(); |
30 | 30 |
31 bool ScheduleRun(const std::string& micro_benchmark_name, | 31 // Returns the id of the benchmark on success, 0 otherwise. |
32 scoped_ptr<base::Value> value, | 32 int ScheduleRun(const std::string& micro_benchmark_name, |
33 const MicroBenchmark::DoneCallback& callback); | 33 scoped_ptr<base::Value> value, |
| 34 const MicroBenchmark::DoneCallback& callback); |
| 35 // Returns true if the message was successfully delivered and handled. |
| 36 bool SendMessage(int id, scoped_ptr<base::Value> value); |
34 | 37 |
35 void ScheduleImplBenchmarks(LayerTreeHostImpl* host_impl); | 38 void ScheduleImplBenchmarks(LayerTreeHostImpl* host_impl); |
36 | 39 |
37 private: | 40 private: |
38 void CleanUpFinishedBenchmarks(); | 41 void CleanUpFinishedBenchmarks(); |
| 42 int GetNextIdAndIncrement(); |
39 | 43 |
40 LayerTreeHost* host_; | 44 LayerTreeHost* host_; |
41 ScopedPtrVector<MicroBenchmark> benchmarks_; | 45 ScopedPtrVector<MicroBenchmark> benchmarks_; |
| 46 static int next_id_; |
42 scoped_refptr<base::MessageLoopProxy> main_controller_message_loop_; | 47 scoped_refptr<base::MessageLoopProxy> main_controller_message_loop_; |
43 | 48 |
44 DISALLOW_COPY_AND_ASSIGN(MicroBenchmarkController); | 49 DISALLOW_COPY_AND_ASSIGN(MicroBenchmarkController); |
45 }; | 50 }; |
46 | 51 |
47 } // namespace cc | 52 } // namespace cc |
48 | 53 |
49 #endif // CC_DEBUG_MICRO_BENCHMARK_CONTROLLER_H_ | 54 #endif // CC_DEBUG_MICRO_BENCHMARK_CONTROLLER_H_ |
OLD | NEW |