| 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 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 Provider::Provider() | 39 Provider::Provider() |
| 40 : binding_(this), tracing_forced_(false), weak_factory_(this) {} | 40 : binding_(this), tracing_forced_(false), weak_factory_(this) {} |
| 41 | 41 |
| 42 Provider::~Provider() { | 42 Provider::~Provider() { |
| 43 StopTracing(); | 43 StopTracing(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void Provider::InitializeWithFactoryInternal(mojom::FactoryPtr* factory) { | 46 void Provider::InitializeWithFactoryInternal(mojom::FactoryPtr* factory) { |
| 47 mojom::ProviderPtr provider; | 47 mojom::ProviderPtr provider; |
| 48 Bind(GetProxy(&provider)); | 48 Bind(MakeRequest(&provider)); |
| 49 (*factory)->CreateRecorder(std::move(provider)); | 49 (*factory)->CreateRecorder(std::move(provider)); |
| 50 #ifdef NDEBUG | 50 #ifdef NDEBUG |
| 51 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 51 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 52 tracing::kEarlyTracing)) { | 52 tracing::kEarlyTracing)) { |
| 53 ForceEnableTracing(); | 53 ForceEnableTracing(); |
| 54 } | 54 } |
| 55 #else | 55 #else |
| 56 ForceEnableTracing(); | 56 ForceEnableTracing(); |
| 57 #endif | 57 #endif |
| 58 } | 58 } |
| (...skipping 92 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(mojo::String(events_str->data())); | 153 recorder_->Record(mojo::String(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 |