Avoid lossy time stamp conversions when caching metadata.
[chromium-blink-merge.git] / cc / debug / micro_benchmark_impl.cc
blob7ec58c8de0be3c8afe1b2fcf7ec35a3dfd16973c
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/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h"
11 #include "base/values.h"
13 namespace cc {
15 namespace {
17 void RunCallback(const MicroBenchmarkImpl::DoneCallback& callback,
18 scoped_ptr<base::Value> result) {
19 callback.Run(result.Pass());
24 MicroBenchmarkImpl::MicroBenchmarkImpl(
25 const DoneCallback& callback,
26 scoped_refptr<base::MessageLoopProxy> origin_loop)
27 : callback_(callback), is_done_(false), origin_loop_(origin_loop) {}
29 MicroBenchmarkImpl::~MicroBenchmarkImpl() {}
31 bool MicroBenchmarkImpl::IsDone() const {
32 return is_done_;
35 void MicroBenchmarkImpl::DidCompleteCommit(LayerTreeHostImpl* host) {}
37 void MicroBenchmarkImpl::NotifyDone(scoped_ptr<base::Value> result) {
38 origin_loop_->PostTask(
39 FROM_HERE,
40 base::Bind(RunCallback, callback_, base::Passed(&result)));
41 is_done_ = true;
44 void MicroBenchmarkImpl::RunOnLayer(LayerImpl* layer) {}
46 void MicroBenchmarkImpl::RunOnLayer(PictureLayerImpl* layer) {}
48 } // namespace cc