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

Side by Side Diff: services/dart/dart_tracing.cc

Issue 1928183002: Use TraceProviderRegistry in //services/dart/dart_tracing.*. (Closed) Base URL: https://github.com/domokit/mojo.git@work787_trace_provider_registry_2
Patch Set: gah Created 4 years, 7 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 "services/dart/dart_tracing.h" 5 #include "services/dart/dart_tracing.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "dart/runtime/include/dart_tools_api.h" 9 #include "dart/runtime/include/dart_tools_api.h"
10 #include "mojo/public/cpp/application/application_impl.h" 10 #include "mojo/public/cpp/application/application_impl.h"
11 #include "mojo/public/cpp/application/connect.h"
11 #include "mojo/public/cpp/bindings/interface_handle.h" 12 #include "mojo/public/cpp/bindings/interface_handle.h"
12 #include "mojo/public/cpp/bindings/interface_request.h" 13 #include "mojo/public/cpp/bindings/interface_request.h"
13 #include "mojo/public/interfaces/application/service_provider.mojom.h" 14 #include "mojo/services/tracing/interfaces/trace_provider_registry.mojom.h"
14 15
15 namespace dart { 16 namespace dart {
16 17
17 void DartTimelineController::Enable(const mojo::String& categories) { 18 void DartTimelineController::Enable(const mojo::String& categories) {
18 if (categories == mojo::String("Dart")) { 19 if (categories == mojo::String("Dart")) {
19 Dart_GlobalTimelineSetRecordedStreams(DART_TIMELINE_STREAM_DART); 20 Dart_GlobalTimelineSetRecordedStreams(DART_TIMELINE_STREAM_DART);
20 } else { 21 } else {
21 // TODO(johnmccutchan): Respect |categories|. 22 // TODO(johnmccutchan): Respect |categories|.
22 EnableAll(); 23 EnableAll();
23 } 24 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 recorder_.reset(); 127 recorder_.reset();
127 } 128 }
128 129
129 DartTracingImpl::DartTracingImpl() { 130 DartTracingImpl::DartTracingImpl() {
130 } 131 }
131 132
132 DartTracingImpl::~DartTracingImpl() { 133 DartTracingImpl::~DartTracingImpl() {
133 } 134 }
134 135
135 void DartTracingImpl::Initialize(mojo::ApplicationImpl* app) { 136 void DartTracingImpl::Initialize(mojo::ApplicationImpl* app) {
136 mojo::InterfaceHandle<mojo::ServiceProvider> outgoing_sp_handle; 137 tracing::TraceProviderRegistryPtr registry;
137 mojo::InterfaceRequest<mojo::ServiceProvider> outgoing_sp_request = 138 ConnectToService(app->shell(), "mojo:tracing", GetProxy(&registry));
138 GetProxy(&outgoing_sp_handle);
139 app->shell()->ConnectToApplication("mojo:tracing", nullptr,
140 outgoing_sp_handle.Pass());
141 outgoing_sp_for_tracing_service_.Bind(outgoing_sp_request.Pass());
142 outgoing_sp_for_tracing_service_.AddService(this);
143 }
144 139
145 void DartTracingImpl::Create( 140 mojo::InterfaceHandle<tracing::TraceProvider> provider;
146 mojo::ApplicationConnection* connection, 141 provider_impl_.Bind(GetProxy(&provider));
147 mojo::InterfaceRequest<tracing::TraceProvider> request) { 142 registry->RegisterTraceProvider(provider.Pass());
jamesr 2016/04/28 23:00:28 this feels like a buncha code that may be repeated
148 provider_impl_.Bind(request.Pass());
149 } 143 }
150 144
151 } // namespace dart 145 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698