| 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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 } | 36 } |
| 37 | 37 |
| 38 Provider::Provider() | 38 Provider::Provider() |
| 39 : binding_(this), tracing_forced_(false), weak_factory_(this) {} | 39 : binding_(this), tracing_forced_(false), weak_factory_(this) {} |
| 40 | 40 |
| 41 Provider::~Provider() { | 41 Provider::~Provider() { |
| 42 StopTracing(); | 42 StopTracing(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void Provider::Initialize(shell::Connector* connector, const std::string& url) { | 45 void Provider::Initialize(service_manager::Connector* connector, |
| 46 const std::string& url) { |
| 46 { | 47 { |
| 47 base::AutoLock lock(g_singleton_lock.Get()); | 48 base::AutoLock lock(g_singleton_lock.Get()); |
| 48 if (g_tracing_singleton_created) | 49 if (g_tracing_singleton_created) |
| 49 return; | 50 return; |
| 50 g_tracing_singleton_created = true; | 51 g_tracing_singleton_created = true; |
| 51 } | 52 } |
| 52 | 53 |
| 53 // This will only set the name for the first app in a loaded mojo file. It's | 54 // This will only set the name for the first app in a loaded mojo file. It's |
| 54 // up to something like CoreServices to name its own child threads. | 55 // up to something like CoreServices to name its own child threads. |
| 55 base::PlatformThread::SetName(url); | 56 base::PlatformThread::SetName(url); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // events. Empty string is not a valid chunk to record so skip in this case. | 138 // events. Empty string is not a valid chunk to record so skip in this case. |
| 138 if (!events_str->data().empty()) { | 139 if (!events_str->data().empty()) { |
| 139 recorder_->Record(mojo::String(events_str->data())); | 140 recorder_->Record(mojo::String(events_str->data())); |
| 140 } | 141 } |
| 141 if (!has_more_events) { | 142 if (!has_more_events) { |
| 142 recorder_.reset(); | 143 recorder_.reset(); |
| 143 } | 144 } |
| 144 } | 145 } |
| 145 | 146 |
| 146 } // namespace tracing | 147 } // namespace tracing |
| OLD | NEW |