OLD | NEW |
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/tracing/public/cpp/provider.h" | 5 #include "services/tracing/public/cpp/provider.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 if (g_tracing_singleton_created) | 52 if (g_tracing_singleton_created) |
53 return; | 53 return; |
54 g_tracing_singleton_created = true; | 54 g_tracing_singleton_created = true; |
55 } | 55 } |
56 | 56 |
57 // This will only set the name for the first app in a loaded mojo file. It's | 57 // This will only set the name for the first app in a loaded mojo file. It's |
58 // up to something like CoreServices to name its own child threads. | 58 // up to something like CoreServices to name its own child threads. |
59 base::PlatformThread::SetName(url); | 59 base::PlatformThread::SetName(url); |
60 | 60 |
61 mojom::FactoryPtr factory; | 61 mojom::FactoryPtr factory; |
62 connector->ConnectToInterface("mojo:tracing", &factory); | 62 connector->ConnectToInterface("service:tracing", &factory); |
63 mojom::ProviderPtr provider; | 63 mojom::ProviderPtr provider; |
64 Bind(GetProxy(&provider)); | 64 Bind(GetProxy(&provider)); |
65 factory->CreateRecorder(std::move(provider)); | 65 factory->CreateRecorder(std::move(provider)); |
66 #ifdef NDEBUG | 66 #ifdef NDEBUG |
67 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 67 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
68 tracing::kEarlyTracing)) { | 68 tracing::kEarlyTracing)) { |
69 ForceEnableTracing(); | 69 ForceEnableTracing(); |
70 } | 70 } |
71 #else | 71 #else |
72 ForceEnableTracing(); | 72 ForceEnableTracing(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // events. Empty string is not a valid chunk to record so skip in this case. | 141 // events. Empty string is not a valid chunk to record so skip in this case. |
142 if (!events_str->data().empty()) { | 142 if (!events_str->data().empty()) { |
143 recorder_->Record(mojo::String(events_str->data())); | 143 recorder_->Record(mojo::String(events_str->data())); |
144 } | 144 } |
145 if (!has_more_events) { | 145 if (!has_more_events) { |
146 recorder_.reset(); | 146 recorder_.reset(); |
147 } | 147 } |
148 } | 148 } |
149 | 149 |
150 } // namespace tracing | 150 } // namespace tracing |
OLD | NEW |