| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MOJO_SERVICES_TRACING_PUBLIC_CPP_TRACE_PROVIDER_IMPL_H_ | |
| 6 #define MOJO_SERVICES_TRACING_PUBLIC_CPP_TRACE_PROVIDER_IMPL_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/ref_counted_memory.h" | |
| 10 #include "base/memory/weak_ptr.h" | |
| 11 #include "mojo/public/cpp/bindings/binding.h" | |
| 12 #include "mojo/public/cpp/bindings/interface_request.h" | |
| 13 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" | |
| 14 | |
| 15 namespace mojo { | |
| 16 | |
| 17 class TraceProviderImpl : public tracing::TraceProvider { | |
| 18 public: | |
| 19 TraceProviderImpl(); | |
| 20 ~TraceProviderImpl() override; | |
| 21 | |
| 22 void Bind(InterfaceRequest<tracing::TraceProvider> request); | |
| 23 | |
| 24 // Enable tracing without waiting for an inbound connection. It will stop if | |
| 25 // no TraceRecorder is sent within a set time. | |
| 26 void ForceEnableTracing(); | |
| 27 | |
| 28 private: | |
| 29 // tracing::TraceProvider implementation: | |
| 30 void StartTracing(const String& categories, | |
| 31 tracing::TraceRecorderPtr recorder) override; | |
| 32 void StopTracing() override; | |
| 33 | |
| 34 void SendChunk(const scoped_refptr<base::RefCountedString>& events_str, | |
| 35 bool has_more_events); | |
| 36 | |
| 37 void DelayedStop(); | |
| 38 // Stop the collection of traces if no external connection asked for them yet. | |
| 39 void StopIfForced(); | |
| 40 | |
| 41 Binding<tracing::TraceProvider> binding_; | |
| 42 bool tracing_forced_; | |
| 43 tracing::TraceRecorderPtr recorder_; | |
| 44 | |
| 45 base::WeakPtrFactory<TraceProviderImpl> weak_factory_; | |
| 46 DISALLOW_COPY_AND_ASSIGN(TraceProviderImpl); | |
| 47 }; | |
| 48 | |
| 49 } // namespace mojo | |
| 50 | |
| 51 #endif // MOJO_SERVICES_TRACING_PUBLIC_CPP_TRACE_PROVIDER_IMPL_H_ | |
| OLD | NEW |