Roll src/third_party/WebKit 1fe317c:a442694 (svn 195222:195224)
[chromium-blink-merge.git] / cc / debug / micro_benchmark_impl.cc
blobf20f32ee33ebfbd97e354c3bd9af5ab63648996c
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 #include "cc/debug/micro_benchmark_impl.h"
7 #include "base/bind.h"
8 #include "base/callback.h"
9 #include "base/location.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/single_thread_task_runner.h"
12 #include "base/values.h"
14 namespace cc {
16 namespace {
18 void RunCallback(const MicroBenchmarkImpl::DoneCallback& callback,
19 scoped_ptr<base::Value> result) {
20 callback.Run(result.Pass());
25 MicroBenchmarkImpl::MicroBenchmarkImpl(
26 const DoneCallback& callback,
27 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner)
28 : callback_(callback),
29 is_done_(false),
30 origin_task_runner_(origin_task_runner) {
33 MicroBenchmarkImpl::~MicroBenchmarkImpl() {}
35 bool MicroBenchmarkImpl::IsDone() const {
36 return is_done_;
39 void MicroBenchmarkImpl::DidCompleteCommit(LayerTreeHostImpl* host) {}
41 void MicroBenchmarkImpl::NotifyDone(scoped_ptr<base::Value> result) {
42 origin_task_runner_->PostTask(
43 FROM_HERE, base::Bind(RunCallback, callback_, base::Passed(&result)));
44 is_done_ = true;
47 void MicroBenchmarkImpl::RunOnLayer(LayerImpl* layer) {}
49 void MicroBenchmarkImpl::RunOnLayer(PictureLayerImpl* layer) {}
51 } // namespace cc