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 11 matching lines...) Expand all Loading... |
22 #include "services/tracing/public/cpp/switches.h" | 22 #include "services/tracing/public/cpp/switches.h" |
23 | 23 |
24 namespace tracing { | 24 namespace tracing { |
25 namespace { | 25 namespace { |
26 | 26 |
27 // Controls access to |g_tracing_singleton_created|, which can be accessed from | 27 // Controls access to |g_tracing_singleton_created|, which can be accessed from |
28 // different threads. | 28 // different threads. |
29 base::LazyInstance<base::Lock>::Leaky g_singleton_lock = | 29 base::LazyInstance<base::Lock>::Leaky g_singleton_lock = |
30 LAZY_INSTANCE_INITIALIZER; | 30 LAZY_INSTANCE_INITIALIZER; |
31 | 31 |
32 // Whether we are the first TracingImpl to be created in this mojo | 32 // Whether we are the first TracingImpl to be created in this service. The first |
33 // application. The first TracingImpl in a physical mojo application connects | 33 // TracingImpl in a physical service connects to the tracing service. |
34 // to the mojo:tracing service. | |
35 // | |
36 // If this is a ContentHandler, it will outlive all its served Applications. If | |
37 // this is a raw mojo application, it is the only Application served. | |
38 bool g_tracing_singleton_created = false; | 34 bool g_tracing_singleton_created = false; |
39 | 35 |
40 } | 36 } |
41 | 37 |
42 Provider::Provider() | 38 Provider::Provider() |
43 : binding_(this), tracing_forced_(false), weak_factory_(this) {} | 39 : binding_(this), tracing_forced_(false), weak_factory_(this) {} |
44 | 40 |
45 Provider::~Provider() { | 41 Provider::~Provider() { |
46 StopTracing(); | 42 StopTracing(); |
47 } | 43 } |
(...skipping 93 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. | 137 // events. Empty string is not a valid chunk to record so skip in this case. |
142 if (!events_str->data().empty()) { | 138 if (!events_str->data().empty()) { |
143 recorder_->Record(mojo::String(events_str->data())); | 139 recorder_->Record(mojo::String(events_str->data())); |
144 } | 140 } |
145 if (!has_more_events) { | 141 if (!has_more_events) { |
146 recorder_.reset(); | 142 recorder_.reset(); |
147 } | 143 } |
148 } | 144 } |
149 | 145 |
150 } // namespace tracing | 146 } // namespace tracing |
OLD | NEW |