summaryrefslogtreecommitdiffstats
path: root/cc/debug/unittest_only_benchmark.h
blob: 7fa2b4dcab4e98eda18f17c5d413692617e63eb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CC_DEBUG_UNITTEST_ONLY_BENCHMARK_H_
#define CC_DEBUG_UNITTEST_ONLY_BENCHMARK_H_

#include "base/memory/weak_ptr.h"
#include "cc/debug/micro_benchmark.h"

namespace cc {

class CC_EXPORT UnittestOnlyBenchmark : public MicroBenchmark {
 public:
  UnittestOnlyBenchmark(scoped_ptr<base::Value> value,
                        const DoneCallback& callback);
  ~UnittestOnlyBenchmark() override;

  void DidUpdateLayers(LayerTreeHost* host) override;
  bool ProcessMessage(scoped_ptr<base::Value> value) override;

 protected:
  scoped_ptr<MicroBenchmarkImpl> CreateBenchmarkImpl(
      scoped_refptr<base::MessageLoopProxy> origin_loop) override;

 private:
  void RecordImplResults(scoped_ptr<base::Value> results);

  bool create_impl_benchmark_;
  base::WeakPtrFactory<UnittestOnlyBenchmark> weak_ptr_factory_;
};

}  // namespace cc

#endif  // CC_DEBUG_UNITTEST_ONLY_BENCHMARK_H_