| 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 #include "cc/debug/micro_benchmark.h" | 5 #include "cc/debug/micro_benchmark.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/callback.h" | 9 #include "base/callback.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/ptr_util.h" |
| 10 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 11 #include "base/values.h" | 13 #include "base/values.h" |
| 12 #include "cc/debug/micro_benchmark_impl.h" | 14 #include "cc/debug/micro_benchmark_impl.h" |
| 13 | 15 |
| 14 namespace cc { | 16 namespace cc { |
| 15 | 17 |
| 16 MicroBenchmark::MicroBenchmark(const DoneCallback& callback) | 18 MicroBenchmark::MicroBenchmark(const DoneCallback& callback) |
| 17 : callback_(callback), | 19 : callback_(callback), |
| 18 is_done_(false), | 20 is_done_(false), |
| 19 processed_for_benchmark_impl_(false), | 21 processed_for_benchmark_impl_(false), |
| 20 id_(0) { | 22 id_(0) { |
| 21 } | 23 } |
| 22 | 24 |
| 23 MicroBenchmark::~MicroBenchmark() {} | 25 MicroBenchmark::~MicroBenchmark() {} |
| 24 | 26 |
| 25 bool MicroBenchmark::IsDone() const { | 27 bool MicroBenchmark::IsDone() const { |
| 26 return is_done_; | 28 return is_done_; |
| 27 } | 29 } |
| 28 | 30 |
| 29 void MicroBenchmark::DidUpdateLayers(LayerTreeHost* host) {} | 31 void MicroBenchmark::DidUpdateLayers(LayerTreeHost* host) {} |
| 30 | 32 |
| 31 void MicroBenchmark::NotifyDone(scoped_ptr<base::Value> result) { | 33 void MicroBenchmark::NotifyDone(std::unique_ptr<base::Value> result) { |
| 32 callback_.Run(std::move(result)); | 34 callback_.Run(std::move(result)); |
| 33 is_done_ = true; | 35 is_done_ = true; |
| 34 } | 36 } |
| 35 | 37 |
| 36 void MicroBenchmark::RunOnLayer(Layer* layer) {} | 38 void MicroBenchmark::RunOnLayer(Layer* layer) {} |
| 37 | 39 |
| 38 void MicroBenchmark::RunOnLayer(PictureLayer* layer) {} | 40 void MicroBenchmark::RunOnLayer(PictureLayer* layer) {} |
| 39 | 41 |
| 40 bool MicroBenchmark::ProcessMessage(scoped_ptr<base::Value> value) { | 42 bool MicroBenchmark::ProcessMessage(std::unique_ptr<base::Value> value) { |
| 41 return false; | 43 return false; |
| 42 } | 44 } |
| 43 | 45 |
| 44 bool MicroBenchmark::ProcessedForBenchmarkImpl() const { | 46 bool MicroBenchmark::ProcessedForBenchmarkImpl() const { |
| 45 return processed_for_benchmark_impl_; | 47 return processed_for_benchmark_impl_; |
| 46 } | 48 } |
| 47 | 49 |
| 48 scoped_ptr<MicroBenchmarkImpl> MicroBenchmark::GetBenchmarkImpl( | 50 std::unique_ptr<MicroBenchmarkImpl> MicroBenchmark::GetBenchmarkImpl( |
| 49 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner) { | 51 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner) { |
| 50 DCHECK(!processed_for_benchmark_impl_); | 52 DCHECK(!processed_for_benchmark_impl_); |
| 51 processed_for_benchmark_impl_ = true; | 53 processed_for_benchmark_impl_ = true; |
| 52 return CreateBenchmarkImpl(origin_task_runner); | 54 return CreateBenchmarkImpl(origin_task_runner); |
| 53 } | 55 } |
| 54 | 56 |
| 55 scoped_ptr<MicroBenchmarkImpl> MicroBenchmark::CreateBenchmarkImpl( | 57 std::unique_ptr<MicroBenchmarkImpl> MicroBenchmark::CreateBenchmarkImpl( |
| 56 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner) { | 58 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner) { |
| 57 return make_scoped_ptr<MicroBenchmarkImpl>(nullptr); | 59 return base::WrapUnique<MicroBenchmarkImpl>(nullptr); |
| 58 } | 60 } |
| 59 | 61 |
| 60 } // namespace cc | 62 } // namespace cc |
| OLD | NEW |