Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: cc/debug/unittest_only_benchmark.cc

Issue 1057283003: Remove parts of //cc we aren't using (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/debug/unittest_only_benchmark.h ('k') | cc/debug/unittest_only_benchmark_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "cc/debug/unittest_only_benchmark.h"
6
7 #include "base/bind.h"
8 #include "base/message_loop/message_loop_proxy.h"
9 #include "base/values.h"
10 #include "cc/debug/unittest_only_benchmark_impl.h"
11
12 namespace cc {
13
14 UnittestOnlyBenchmark::UnittestOnlyBenchmark(scoped_ptr<base::Value> value,
15 const DoneCallback& callback)
16 : MicroBenchmark(callback),
17 create_impl_benchmark_(false),
18 weak_ptr_factory_(this) {
19 if (!value)
20 return;
21
22 base::DictionaryValue* settings = nullptr;
23 value->GetAsDictionary(&settings);
24 if (!settings)
25 return;
26
27 if (settings->HasKey("run_benchmark_impl"))
28 settings->GetBoolean("run_benchmark_impl", &create_impl_benchmark_);
29 }
30
31 UnittestOnlyBenchmark::~UnittestOnlyBenchmark() {
32 weak_ptr_factory_.InvalidateWeakPtrs();
33 }
34
35 void UnittestOnlyBenchmark::DidUpdateLayers(LayerTreeHost* host) {
36 NotifyDone(nullptr);
37 }
38
39 bool UnittestOnlyBenchmark::ProcessMessage(scoped_ptr<base::Value> value) {
40 base::DictionaryValue* message = nullptr;
41 value->GetAsDictionary(&message);
42 bool can_handle;
43 if (message->HasKey("can_handle")) {
44 message->GetBoolean("can_handle", &can_handle);
45 if (can_handle)
46 return true;
47 }
48 return false;
49 }
50
51 void UnittestOnlyBenchmark::RecordImplResults(scoped_ptr<base::Value> results) {
52 NotifyDone(results.Pass());
53 }
54
55 scoped_ptr<MicroBenchmarkImpl> UnittestOnlyBenchmark::CreateBenchmarkImpl(
56 scoped_refptr<base::MessageLoopProxy> origin_loop) {
57 if (!create_impl_benchmark_)
58 return make_scoped_ptr<MicroBenchmarkImpl>(nullptr);
59
60 return make_scoped_ptr(new UnittestOnlyBenchmarkImpl(
61 origin_loop,
62 nullptr,
63 base::Bind(&UnittestOnlyBenchmark::RecordImplResults,
64 weak_ptr_factory_.GetWeakPtr())));
65 }
66
67 } // namespace cc
OLDNEW
« no previous file with comments | « cc/debug/unittest_only_benchmark.h ('k') | cc/debug/unittest_only_benchmark_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698