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 <memory> |
| 9 |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
11 | 12 |
12 namespace base { | 13 namespace base { |
13 class SingleThreadTaskRunner; | 14 class SingleThreadTaskRunner; |
14 class Value; | 15 class Value; |
15 } // namespace base | 16 } // namespace base |
16 | 17 |
17 namespace cc { | 18 namespace cc { |
18 | 19 |
19 class LayerTreeHost; | 20 class LayerTreeHost; |
20 class Layer; | 21 class Layer; |
21 class PictureLayer; | 22 class PictureLayer; |
22 class MicroBenchmarkImpl; | 23 class MicroBenchmarkImpl; |
23 class CC_EXPORT MicroBenchmark { | 24 class CC_EXPORT MicroBenchmark { |
24 public: | 25 public: |
25 typedef base::Callback<void(scoped_ptr<base::Value>)> DoneCallback; | 26 typedef base::Callback<void(std::unique_ptr<base::Value>)> DoneCallback; |
26 | 27 |
27 explicit MicroBenchmark(const DoneCallback& callback); | 28 explicit MicroBenchmark(const DoneCallback& callback); |
28 virtual ~MicroBenchmark(); | 29 virtual ~MicroBenchmark(); |
29 | 30 |
30 bool IsDone() const; | 31 bool IsDone() const; |
31 virtual void DidUpdateLayers(LayerTreeHost* host); | 32 virtual void DidUpdateLayers(LayerTreeHost* host); |
32 int id() const { return id_; } | 33 int id() const { return id_; } |
33 void set_id(int id) { id_ = id; } | 34 void set_id(int id) { id_ = id; } |
34 | 35 |
35 virtual void RunOnLayer(Layer* layer); | 36 virtual void RunOnLayer(Layer* layer); |
36 virtual void RunOnLayer(PictureLayer* layer); | 37 virtual void RunOnLayer(PictureLayer* layer); |
37 | 38 |
38 virtual bool ProcessMessage(scoped_ptr<base::Value> value); | 39 virtual bool ProcessMessage(std::unique_ptr<base::Value> value); |
39 | 40 |
40 bool ProcessedForBenchmarkImpl() const; | 41 bool ProcessedForBenchmarkImpl() const; |
41 scoped_ptr<MicroBenchmarkImpl> GetBenchmarkImpl( | 42 std::unique_ptr<MicroBenchmarkImpl> GetBenchmarkImpl( |
42 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner); | 43 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner); |
43 | 44 |
44 protected: | 45 protected: |
45 void NotifyDone(scoped_ptr<base::Value> result); | 46 void NotifyDone(std::unique_ptr<base::Value> result); |
46 | 47 |
47 virtual scoped_ptr<MicroBenchmarkImpl> CreateBenchmarkImpl( | 48 virtual std::unique_ptr<MicroBenchmarkImpl> CreateBenchmarkImpl( |
48 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner); | 49 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner); |
49 | 50 |
50 private: | 51 private: |
51 DoneCallback callback_; | 52 DoneCallback callback_; |
52 bool is_done_; | 53 bool is_done_; |
53 bool processed_for_benchmark_impl_; | 54 bool processed_for_benchmark_impl_; |
54 int id_; | 55 int id_; |
55 }; | 56 }; |
56 | 57 |
57 } // namespace cc | 58 } // namespace cc |
58 | 59 |
59 #endif // CC_DEBUG_MICRO_BENCHMARK_H_ | 60 #endif // CC_DEBUG_MICRO_BENCHMARK_H_ |
OLD | NEW |