WorkspaceLayoutManager backdrop should fill entire region.
[chromium-blink-merge.git] / cc / debug / micro_benchmark_controller_impl.cc
blob821ba5f8d4493c6cacc7d5483937a5bc60e4475e
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_controller_impl.h"
7 #include <string>
9 #include "base/callback.h"
10 #include "base/values.h"
11 #include "cc/trees/layer_tree_host_impl.h"
13 namespace cc {
15 namespace {
17 class IsDonePredicate {
18 public:
19 typedef const MicroBenchmarkImpl* argument_type;
20 typedef bool result_type;
22 result_type operator()(argument_type benchmark) const {
23 return benchmark->IsDone();
27 } // namespace
29 MicroBenchmarkControllerImpl::MicroBenchmarkControllerImpl(
30 LayerTreeHostImpl* host)
31 : host_(host) {
32 DCHECK(host_);
35 MicroBenchmarkControllerImpl::~MicroBenchmarkControllerImpl() {}
37 void MicroBenchmarkControllerImpl::ScheduleRun(
38 scoped_ptr<MicroBenchmarkImpl> benchmark) {
39 benchmarks_.push_back(benchmark.Pass());
42 void MicroBenchmarkControllerImpl::DidCompleteCommit() {
43 for (ScopedPtrVector<MicroBenchmarkImpl>::iterator it = benchmarks_.begin();
44 it != benchmarks_.end();
45 ++it) {
46 DCHECK(!(*it)->IsDone());
47 (*it)->DidCompleteCommit(host_);
50 CleanUpFinishedBenchmarks();
53 void MicroBenchmarkControllerImpl::CleanUpFinishedBenchmarks() {
54 benchmarks_.erase(
55 benchmarks_.partition(std::not1(IsDonePredicate())),
56 benchmarks_.end());
59 } // namespace cc