Fix redundant flushes in CommandBufferHelper::WaitForToken().
[chromium-blink-merge.git] / cc / debug / micro_benchmark.h
blobf179fb9544d200ef30373fc4be88b1836c9469ea
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
3 // found in the LICENSE file.
5 #ifndef CC_DEBUG_MICRO_BENCHMARK_H_
6 #define CC_DEBUG_MICRO_BENCHMARK_H_
8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/base/cc_export.h"
12 namespace base {
13 class Value;
14 class MessageLoopProxy;
15 } // namespace base
17 namespace cc {
19 class LayerTreeHost;
20 class Layer;
21 class PictureLayer;
22 class MicroBenchmarkImpl;
23 class CC_EXPORT MicroBenchmark {
24 public:
25 typedef base::Callback<void(scoped_ptr<base::Value>)> DoneCallback;
27 explicit MicroBenchmark(const DoneCallback& callback);
28 virtual ~MicroBenchmark();
30 bool IsDone() const;
31 virtual void DidUpdateLayers(LayerTreeHost* host);
33 virtual void RunOnLayer(Layer* layer);
34 virtual void RunOnLayer(PictureLayer* layer);
36 bool ProcessedForBenchmarkImpl() const;
37 scoped_ptr<MicroBenchmarkImpl> GetBenchmarkImpl(
38 scoped_refptr<base::MessageLoopProxy> origin_loop);
40 protected:
41 void NotifyDone(scoped_ptr<base::Value> result);
43 virtual scoped_ptr<MicroBenchmarkImpl> CreateBenchmarkImpl(
44 scoped_refptr<base::MessageLoopProxy> origin_loop);
46 private:
47 DoneCallback callback_;
48 bool is_done_;
49 bool processed_for_benchmark_impl_;
52 } // namespace cc
54 #endif // CC_DEBUG_MICRO_BENCHMARK_H_