| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 void Provider::Initialize(service_manager::Connector* connector, | 70 void Provider::Initialize(service_manager::Connector* connector, |
| 71 const std::string& url) { | 71 const std::string& url) { |
| 72 { | 72 { |
| 73 base::AutoLock lock(g_singleton_lock.Get()); | 73 base::AutoLock lock(g_singleton_lock.Get()); |
| 74 if (g_tracing_singleton_created) | 74 if (g_tracing_singleton_created) |
| 75 return; | 75 return; |
| 76 g_tracing_singleton_created = true; | 76 g_tracing_singleton_created = true; |
| 77 } | 77 } |
| 78 mojom::FactoryPtr factory; | 78 mojom::FactoryPtr factory; |
| 79 connector->ConnectToInterface(tracing::mojom::kServiceName, &factory); | 79 connector->BindInterface(tracing::mojom::kServiceName, &factory); |
| 80 InitializeWithFactoryInternal(&factory); | 80 InitializeWithFactoryInternal(&factory); |
| 81 // This will only set the name for the first app in a loaded mojo file. It's | 81 // This will only set the name for the first app in a loaded mojo file. It's |
| 82 // up to something like CoreServices to name its own child threads. | 82 // up to something like CoreServices to name its own child threads. |
| 83 base::PlatformThread::SetName(url); | 83 base::PlatformThread::SetName(url); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void Provider::Bind(mojom::ProviderRequest request) { | 86 void Provider::Bind(mojom::ProviderRequest request) { |
| 87 if (!binding_.is_bound()) { | 87 if (!binding_.is_bound()) { |
| 88 binding_.Bind(std::move(request)); | 88 binding_.Bind(std::move(request)); |
| 89 } else { | 89 } else { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // events. Empty string is not a valid chunk to record so skip in this case. | 151 // events. Empty string is not a valid chunk to record so skip in this case. |
| 152 if (!events_str->data().empty()) { | 152 if (!events_str->data().empty()) { |
| 153 recorder_->Record(events_str->data()); | 153 recorder_->Record(events_str->data()); |
| 154 } | 154 } |
| 155 if (!has_more_events) { | 155 if (!has_more_events) { |
| 156 recorder_.reset(); | 156 recorder_.reset(); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace tracing | 160 } // namespace tracing |
| OLD | NEW |