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

Side by Side Diff: mojo/common/tracing_impl.cc

Issue 1334213002: Support for tracing app initialization. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 3 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 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/callback.h"
8 #include "base/time/time.h"
9 #include "base/trace_event/trace_config.h"
10 #include "base/trace_event/trace_event.h"
qsr 2015/09/11 15:12:20 Most of those includes seem not useful.
etiennej 2015/09/11 15:16:45 Done.
7 #include "base/trace_event/trace_event_impl.h" 11 #include "base/trace_event/trace_event_impl.h"
8 #include "mojo/common/trace_provider_impl.h"
9 #include "mojo/public/cpp/application/application_connection.h" 12 #include "mojo/public/cpp/application/application_connection.h"
10 #include "mojo/public/cpp/application/application_impl.h" 13 #include "mojo/public/cpp/application/application_impl.h"
11 14
12 namespace mojo { 15 namespace mojo {
13 16
14 TracingImpl::TracingImpl() { 17 TracingImpl::TracingImpl() {}
15 }
16 18
17 TracingImpl::~TracingImpl() { 19 TracingImpl::~TracingImpl() {}
18 }
19 20
20 void TracingImpl::Initialize(ApplicationImpl* app) { 21 void TracingImpl::Initialize(ApplicationImpl* app) {
21 ApplicationConnection* connection = app->ConnectToApplication("mojo:tracing"); 22 ApplicationConnection* connection = app->ConnectToApplication("mojo:tracing");
22 connection->AddService(this); 23 connection->AddService(this);
24
25 #ifdef NDEBUG
26 if (app->HasArg("--early-tracing")) {
27 provider_impl_.EnableTracingNow();
28 }
29 #else
30 provider_impl_.EnableTracingNow();
31 #endif
23 } 32 }
24 33
25 void TracingImpl::Create(ApplicationConnection* connection, 34 void TracingImpl::Create(ApplicationConnection* connection,
26 InterfaceRequest<tracing::TraceProvider> request) { 35 InterfaceRequest<tracing::TraceProvider> request) {
27 new TraceProviderImpl(request.Pass()); 36 provider_impl_.Bind(request.Pass());
28 } 37 }
29 38
30 } // namespace mojo 39 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698