OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/tracing_impl.h" | 5 #include "mojo/common/tracing_impl.h" |
6 | 6 |
7 #include "base/trace_event/trace_event_impl.h" | 7 #include "base/trace_event/trace_event_impl.h" |
8 #include "mojo/public/cpp/application/application_impl.h" | 8 #include "mojo/public/cpp/application/application_impl.h" |
9 #include "mojo/public/cpp/application/connect.h" | 9 #include "mojo/public/cpp/application/connect.h" |
10 #include "mojo/public/cpp/bindings/interface_handle.h" | 10 #include "mojo/public/cpp/bindings/interface_handle.h" |
11 #include "mojo/public/cpp/bindings/interface_request.h" | 11 #include "mojo/public/cpp/bindings/interface_request.h" |
12 #include "mojo/public/interfaces/application/service_provider.mojom.h" | |
13 #include "mojo/services/tracing/interfaces/trace_provider_registry.mojom.h" | 12 #include "mojo/services/tracing/interfaces/trace_provider_registry.mojom.h" |
14 #include "mojo/services/tracing/interfaces/tracing.mojom.h" | 13 #include "mojo/services/tracing/interfaces/tracing.mojom.h" |
15 | 14 |
16 namespace mojo { | 15 namespace mojo { |
17 | 16 |
18 TracingImpl::TracingImpl() {} | 17 TracingImpl::TracingImpl() {} |
19 | 18 |
20 TracingImpl::~TracingImpl() {} | 19 TracingImpl::~TracingImpl() {} |
21 | 20 |
22 void TracingImpl::Initialize(ApplicationImpl* app) { | 21 void TracingImpl::Initialize(ApplicationImpl* app) { |
23 tracing::TraceProviderRegistryPtr registry; | 22 tracing::TraceProviderRegistryPtr registry; |
24 ConnectToService(app->shell(), "mojo:tracing", GetProxy(®istry)); | 23 ConnectToService(app->shell(), "mojo:tracing", GetProxy(®istry)); |
25 | 24 |
26 mojo::InterfaceHandle<tracing::TraceProvider> provider; | 25 mojo::InterfaceHandle<tracing::TraceProvider> provider; |
27 provider_impl_.Bind(GetProxy(&provider)); | 26 provider_impl_.Bind(GetProxy(&provider)); |
28 registry->RegisterTraceProvider(provider.Pass()); | 27 registry->RegisterTraceProvider(provider.Pass()); |
29 | 28 |
30 #ifdef NDEBUG | 29 #ifdef NDEBUG |
31 if (app->HasArg("--early-tracing")) { | 30 if (app->HasArg("--early-tracing")) { |
32 provider_impl_.ForceEnableTracing(); | 31 provider_impl_.ForceEnableTracing(); |
33 } | 32 } |
34 #else | 33 #else |
35 provider_impl_.ForceEnableTracing(); | 34 provider_impl_.ForceEnableTracing(); |
36 #endif | 35 #endif |
37 } | 36 } |
38 | 37 |
39 } // namespace mojo | 38 } // namespace mojo |
OLD | NEW |