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

Side by Side Diff: apps/benchmark/benchmark_app.cc

Issue 1915403002: ApplicationImpl::ConnectToServiceDeprecated() -> mojo::ConnectToService() conversion, part 2. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: doh Created 4 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 | « no previous file | examples/audio_play_test/play_tone.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <memory> 5 #include <memory>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "apps/benchmark/event.h" 10 #include "apps/benchmark/event.h"
11 #include "apps/benchmark/measurements.h" 11 #include "apps/benchmark/measurements.h"
12 #include "apps/benchmark/run_args.h" 12 #include "apps/benchmark/run_args.h"
13 #include "apps/benchmark/trace_collector_client.h" 13 #include "apps/benchmark/trace_collector_client.h"
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/strings/string_split.h" 18 #include "base/strings/string_split.h"
19 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "base/trace_event/trace_event.h" 21 #include "base/trace_event/trace_event.h"
22 #include "mojo/application/application_runner_chromium.h" 22 #include "mojo/application/application_runner_chromium.h"
23 #include "mojo/public/c/system/main.h" 23 #include "mojo/public/c/system/main.h"
24 #include "mojo/public/cpp/application/application_connection.h" 24 #include "mojo/public/cpp/application/application_connection.h"
25 #include "mojo/public/cpp/application/application_delegate.h" 25 #include "mojo/public/cpp/application/application_delegate.h"
26 #include "mojo/public/cpp/application/application_impl.h" 26 #include "mojo/public/cpp/application/application_impl.h"
27 #include "mojo/public/cpp/application/connect.h"
27 #include "mojo/services/tracing/interfaces/tracing.mojom.h" 28 #include "mojo/services/tracing/interfaces/tracing.mojom.h"
28 29
29 namespace benchmark { 30 namespace benchmark {
30 namespace { 31 namespace {
31 32
32 class BenchmarkApp : public mojo::ApplicationDelegate, 33 class BenchmarkApp : public mojo::ApplicationDelegate,
33 public TraceCollectorClient::Receiver { 34 public TraceCollectorClient::Receiver {
34 public: 35 public:
35 BenchmarkApp() {} 36 BenchmarkApp() {}
36 ~BenchmarkApp() override {} 37 ~BenchmarkApp() override {}
(...skipping 11 matching lines...) Expand all
48 std::string categories_str; 49 std::string categories_str;
49 if (args_.write_output_file) { 50 if (args_.write_output_file) {
50 categories_str = "*"; 51 categories_str = "*";
51 } else { 52 } else {
52 categories_str = ComputeCategoriesStr(); 53 categories_str = ComputeCategoriesStr();
53 } 54 }
54 55
55 // Connect to trace collector, which will fetch the trace events produced by 56 // Connect to trace collector, which will fetch the trace events produced by
56 // the app being benchmarked. 57 // the app being benchmarked.
57 tracing::TraceCollectorPtr trace_collector; 58 tracing::TraceCollectorPtr trace_collector;
58 app->ConnectToServiceDeprecated("mojo:tracing", &trace_collector); 59 mojo::ConnectToService(app->shell(), "mojo:tracing",
60 GetProxy(&trace_collector));
59 trace_collector_client_.reset( 61 trace_collector_client_.reset(
60 new TraceCollectorClient(this, trace_collector.Pass())); 62 new TraceCollectorClient(this, trace_collector.Pass()));
61 trace_collector_client_->Start(categories_str); 63 trace_collector_client_->Start(categories_str);
62 64
63 // Start tracing the application with 1 sec of delay. 65 // Start tracing the application with 1 sec of delay.
64 base::MessageLoop::current()->PostDelayedTask( 66 base::MessageLoop::current()->PostDelayedTask(
65 FROM_HERE, base::Bind(&BenchmarkApp::StartTracedApplication, 67 FROM_HERE, base::Bind(&BenchmarkApp::StartTracedApplication,
66 base::Unretained(this), app), 68 base::Unretained(this), app),
67 base::TimeDelta::FromSeconds(1)); 69 base::TimeDelta::FromSeconds(1));
68 } 70 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 }; 157 };
156 } // namespace 158 } // namespace
157 } // namespace benchmark 159 } // namespace benchmark
158 160
159 MojoResult MojoMain(MojoHandle application_request) { 161 MojoResult MojoMain(MojoHandle application_request) {
160 mojo::ApplicationRunnerChromium runner(new benchmark::BenchmarkApp); 162 mojo::ApplicationRunnerChromium runner(new benchmark::BenchmarkApp);
161 auto ret = runner.Run(application_request); 163 auto ret = runner.Run(application_request);
162 fflush(nullptr); 164 fflush(nullptr);
163 return ret; 165 return ret;
164 } 166 }
OLDNEW
« no previous file with comments | « no previous file | examples/audio_play_test/play_tone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698