| Index: mojo/common/trace_provider_impl.h
|
| diff --git a/mojo/common/trace_provider_impl.h b/mojo/common/trace_provider_impl.h
|
| index 82735a57c8cef7d9e7da11a5145b87a0d5973083..7962a9740fb1716071ba7f6ec485d83331cc0a04 100644
|
| --- a/mojo/common/trace_provider_impl.h
|
| +++ b/mojo/common/trace_provider_impl.h
|
| @@ -6,24 +6,22 @@
|
| #define MOJO_COMMON_TRACE_PROVIDER_IMPL_H_
|
|
|
| #include "base/memory/ref_counted_memory.h"
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "mojo/public/cpp/bindings/binding.h"
|
| #include "mojo/public/cpp/bindings/interface_request.h"
|
| -#include "mojo/public/cpp/bindings/strong_binding.h"
|
| #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
|
|
|
| namespace mojo {
|
|
|
| class TraceProviderImpl : public tracing::TraceProvider {
|
| public:
|
| - explicit TraceProviderImpl(InterfaceRequest<tracing::TraceProvider> request);
|
| + TraceProviderImpl();
|
| ~TraceProviderImpl() override;
|
|
|
| - // Set to true if base::trace_event::TraceLog is enabled externally to this
|
| - // class. If this is set to true this class will save the collector but not
|
| - // enable tracing when it receives a StartTracing message from the tracing
|
| - // service.
|
| - void set_tracing_already_started(bool tracing_already_started) {
|
| - tracing_already_started_ = tracing_already_started;
|
| - }
|
| + void Bind(InterfaceRequest<tracing::TraceProvider> request);
|
| +
|
| + // Enable tracing without waiting for an inbound connection.
|
| + void EnableTracingNow();
|
|
|
| private:
|
| // tracing::TraceProvider implementation:
|
| @@ -34,10 +32,15 @@ class TraceProviderImpl : public tracing::TraceProvider {
|
| void SendChunk(const scoped_refptr<base::RefCountedString>& events_str,
|
| bool has_more_events);
|
|
|
| - bool tracing_already_started_;
|
| + void DelayedStop();
|
| + // Stop the collection of traces if no external connection asked for them yet.
|
| + void StopIfForced();
|
| +
|
| + Binding<tracing::TraceProvider> binding_;
|
| + bool tracing_forced_;
|
| tracing::TraceRecorderPtr recorder_;
|
| - StrongBinding<tracing::TraceProvider> binding_;
|
|
|
| + base::WeakPtrFactory<TraceProviderImpl> weak_factory_;
|
| DISALLOW_COPY_AND_ASSIGN(TraceProviderImpl);
|
| };
|
|
|
|
|