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

Side by Side Diff: mojo/services/tracing/tracing_app.cc

Issue 1681813002: Rename Connection::AddService/ConnectToService to Connection::AddInterface/GetInterface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface_binder
Patch Set: . Created 4 years, 10 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
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 "mojo/services/tracing/tracing_app.h" 5 #include "mojo/services/tracing/tracing_app.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 15
16 namespace tracing { 16 namespace tracing {
17 17
18 TracingApp::TracingApp() : collector_binding_(this), tracing_active_(false) { 18 TracingApp::TracingApp() : collector_binding_(this), tracing_active_(false) {
19 } 19 }
20 20
21 TracingApp::~TracingApp() { 21 TracingApp::~TracingApp() {
22 } 22 }
23 23
24 bool TracingApp::AcceptConnection(mojo::Connection* connection) { 24 bool TracingApp::AcceptConnection(mojo::Connection* connection) {
25 connection->AddService<TraceCollector>(this); 25 connection->AddInterface<TraceCollector>(this);
26 connection->AddService<StartupPerformanceDataCollector>(this); 26 connection->AddInterface<StartupPerformanceDataCollector>(this);
27 27
28 // If someone connects to us they may want to use the TraceCollector 28 // If someone connects to us they may want to use the TraceCollector
29 // interface and/or they may want to expose themselves to be traced. Attempt 29 // interface and/or they may want to expose themselves to be traced. Attempt
30 // to connect to the TraceProvider interface to see if the application 30 // to connect to the TraceProvider interface to see if the application
31 // connecting to us wants to be traced. They can refuse the connection or 31 // connecting to us wants to be traced. They can refuse the connection or
32 // close the pipe if not. 32 // close the pipe if not.
33 TraceProviderPtr provider_ptr; 33 TraceProviderPtr provider_ptr;
34 connection->ConnectToService(&provider_ptr); 34 connection->GetInterface(&provider_ptr);
35 if (tracing_active_) { 35 if (tracing_active_) {
36 TraceRecorderPtr recorder_ptr; 36 TraceRecorderPtr recorder_ptr;
37 recorder_impls_.push_back( 37 recorder_impls_.push_back(
38 new TraceRecorderImpl(GetProxy(&recorder_ptr), sink_.get())); 38 new TraceRecorderImpl(GetProxy(&recorder_ptr), sink_.get()));
39 provider_ptr->StartTracing(tracing_categories_, std::move(recorder_ptr)); 39 provider_ptr->StartTracing(tracing_categories_, std::move(recorder_ptr));
40 } 40 }
41 provider_ptrs_.AddInterfacePtr(std::move(provider_ptr)); 41 provider_ptrs_.AddInterfacePtr(std::move(provider_ptr));
42 return true; 42 return true;
43 } 43 }
44 44
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 const GetStartupPerformanceTimesCallback& callback) { 169 const GetStartupPerformanceTimesCallback& callback) {
170 callback.Run(startup_performance_times_.Clone()); 170 callback.Run(startup_performance_times_.Clone());
171 } 171 }
172 172
173 void TracingApp::AllDataCollected() { 173 void TracingApp::AllDataCollected() {
174 recorder_impls_.clear(); 174 recorder_impls_.clear();
175 sink_.reset(); 175 sink_.reset();
176 } 176 }
177 177
178 } // namespace tracing 178 } // namespace tracing
OLDNEW
« no previous file with comments | « mojo/services/tracing/public/cpp/tracing_impl.cc ('k') | mojo/shell/application_manager_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698