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

Side by Side Diff: mojo/services/tracing/public/cpp/tracing_impl.cc

Issue 1455833005: Convert ConnectToApplication to take a params class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 1 month 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/services/tracing/public/cpp/tracing_impl.h" 5 #include "mojo/services/tracing/public/cpp/tracing_impl.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/synchronization/lock.h" 8 #include "base/synchronization/lock.h"
9 #include "base/threading/platform_thread.h" 9 #include "base/threading/platform_thread.h"
10 #include "base/trace_event/trace_event_impl.h" 10 #include "base/trace_event/trace_event_impl.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 base::AutoLock lock(g_singleton_lock.Get()); 44 base::AutoLock lock(g_singleton_lock.Get());
45 if (g_tracing_singleton_created) 45 if (g_tracing_singleton_created)
46 return; 46 return;
47 g_tracing_singleton_created = true; 47 g_tracing_singleton_created = true;
48 } 48 }
49 49
50 // This will only set the name for the first app in a loaded mojo file. It's 50 // This will only set the name for the first app in a loaded mojo file. It's
51 // up to something like CoreServices to name its own child threads. 51 // up to something like CoreServices to name its own child threads.
52 base::PlatformThread::SetName(app->url()); 52 base::PlatformThread::SetName(app->url());
53 53
54 mojo::URLRequestPtr request(mojo::URLRequest::New()); 54 connection_ = app->ConnectToApplication("mojo:tracing");
55 request->url = mojo::String::From("mojo:tracing");
56 connection_ = app->ConnectToApplication(request.Pass());
57 connection_->AddService(this); 55 connection_->AddService(this);
58 56
59 #ifdef NDEBUG 57 #ifdef NDEBUG
60 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 58 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
61 tracing::kEarlyTracing)) { 59 tracing::kEarlyTracing)) {
62 provider_impl_.ForceEnableTracing(); 60 provider_impl_.ForceEnableTracing();
63 } 61 }
64 #else 62 #else
65 provider_impl_.ForceEnableTracing(); 63 provider_impl_.ForceEnableTracing();
66 #endif 64 #endif
67 } 65 }
68 66
69 void TracingImpl::Create(ApplicationConnection* connection, 67 void TracingImpl::Create(ApplicationConnection* connection,
70 InterfaceRequest<tracing::TraceProvider> request) { 68 InterfaceRequest<tracing::TraceProvider> request) {
71 provider_impl_.Bind(request.Pass()); 69 provider_impl_.Bind(request.Pass());
72 } 70 }
73 71
74 } // namespace mojo 72 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/test_service/test_time_service_impl.cc ('k') | mojo/shell/application_manager_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698