Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Unified Diff: mojo/common/trace_provider_impl.h

Issue 1334213002: Support for tracing app initialization. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « examples/trace_me/trace_me_app.cc ('k') | mojo/common/trace_provider_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « examples/trace_me/trace_me_app.cc ('k') | mojo/common/trace_provider_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698