| 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_impl.h" | 5 #include "cc/debug/micro_benchmark_impl.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/callback.h" | 10 #include "base/callback.h" |
| 9 #include "base/location.h" | 11 #include "base/location.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 12 #include "base/values.h" | 13 #include "base/values.h" |
| 13 | 14 |
| 14 namespace cc { | 15 namespace cc { |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 void RunCallback(const MicroBenchmarkImpl::DoneCallback& callback, | 19 void RunCallback(const MicroBenchmarkImpl::DoneCallback& callback, |
| 19 scoped_ptr<base::Value> result) { | 20 std::unique_ptr<base::Value> result) { |
| 20 callback.Run(std::move(result)); | 21 callback.Run(std::move(result)); |
| 21 } | 22 } |
| 22 | 23 |
| 23 } | 24 } |
| 24 | 25 |
| 25 MicroBenchmarkImpl::MicroBenchmarkImpl( | 26 MicroBenchmarkImpl::MicroBenchmarkImpl( |
| 26 const DoneCallback& callback, | 27 const DoneCallback& callback, |
| 27 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner) | 28 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner) |
| 28 : callback_(callback), | 29 : callback_(callback), |
| 29 is_done_(false), | 30 is_done_(false), |
| 30 origin_task_runner_(origin_task_runner) { | 31 origin_task_runner_(origin_task_runner) { |
| 31 } | 32 } |
| 32 | 33 |
| 33 MicroBenchmarkImpl::~MicroBenchmarkImpl() {} | 34 MicroBenchmarkImpl::~MicroBenchmarkImpl() {} |
| 34 | 35 |
| 35 bool MicroBenchmarkImpl::IsDone() const { | 36 bool MicroBenchmarkImpl::IsDone() const { |
| 36 return is_done_; | 37 return is_done_; |
| 37 } | 38 } |
| 38 | 39 |
| 39 void MicroBenchmarkImpl::DidCompleteCommit(LayerTreeHostImpl* host) {} | 40 void MicroBenchmarkImpl::DidCompleteCommit(LayerTreeHostImpl* host) {} |
| 40 | 41 |
| 41 void MicroBenchmarkImpl::NotifyDone(scoped_ptr<base::Value> result) { | 42 void MicroBenchmarkImpl::NotifyDone(std::unique_ptr<base::Value> result) { |
| 42 origin_task_runner_->PostTask( | 43 origin_task_runner_->PostTask( |
| 43 FROM_HERE, base::Bind(RunCallback, callback_, base::Passed(&result))); | 44 FROM_HERE, base::Bind(RunCallback, callback_, base::Passed(&result))); |
| 44 is_done_ = true; | 45 is_done_ = true; |
| 45 } | 46 } |
| 46 | 47 |
| 47 void MicroBenchmarkImpl::RunOnLayer(LayerImpl* layer) {} | 48 void MicroBenchmarkImpl::RunOnLayer(LayerImpl* layer) {} |
| 48 | 49 |
| 49 void MicroBenchmarkImpl::RunOnLayer(PictureLayerImpl* layer) {} | 50 void MicroBenchmarkImpl::RunOnLayer(PictureLayerImpl* layer) {} |
| 50 | 51 |
| 51 } // namespace cc | 52 } // namespace cc |
| OLD | NEW |