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