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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef MOJO_COMMON_TRACE_PROVIDER_IMPL_H_ 5 #ifndef MOJO_COMMON_TRACE_PROVIDER_IMPL_H_
6 #define MOJO_COMMON_TRACE_PROVIDER_IMPL_H_ 6 #define MOJO_COMMON_TRACE_PROVIDER_IMPL_H_
7 7
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/memory/weak_ptr.h"
10 #include "mojo/public/cpp/bindings/binding.h"
9 #include "mojo/public/cpp/bindings/interface_request.h" 11 #include "mojo/public/cpp/bindings/interface_request.h"
10 #include "mojo/public/cpp/bindings/strong_binding.h"
11 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" 12 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
12 13
13 namespace mojo { 14 namespace mojo {
14 15
15 class TraceProviderImpl : public tracing::TraceProvider { 16 class TraceProviderImpl : public tracing::TraceProvider {
16 public: 17 public:
17 explicit TraceProviderImpl(InterfaceRequest<tracing::TraceProvider> request); 18 TraceProviderImpl();
18 ~TraceProviderImpl() override; 19 ~TraceProviderImpl() override;
19 20
20 // Set to true if base::trace_event::TraceLog is enabled externally to this 21 void Bind(InterfaceRequest<tracing::TraceProvider> request);
21 // class. If this is set to true this class will save the collector but not 22
22 // enable tracing when it receives a StartTracing message from the tracing 23 // Enable tracing without waiting for an inbound connection.
23 // service. 24 void EnableTracingNow();
24 void set_tracing_already_started(bool tracing_already_started) {
25 tracing_already_started_ = tracing_already_started;
26 }
27 25
28 private: 26 private:
29 // tracing::TraceProvider implementation: 27 // tracing::TraceProvider implementation:
30 void StartTracing(const String& categories, 28 void StartTracing(const String& categories,
31 tracing::TraceRecorderPtr collector) override; 29 tracing::TraceRecorderPtr collector) override;
32 void StopTracing() override; 30 void StopTracing() override;
33 31
34 void SendChunk(const scoped_refptr<base::RefCountedString>& events_str, 32 void SendChunk(const scoped_refptr<base::RefCountedString>& events_str,
35 bool has_more_events); 33 bool has_more_events);
36 34
37 bool tracing_already_started_; 35 void DelayedStop();
36 // Stop the collection of traces if no external connection asked for them yet.
37 void StopIfForced();
38
39 Binding<tracing::TraceProvider> binding_;
40 bool tracing_forced_;
38 tracing::TraceRecorderPtr recorder_; 41 tracing::TraceRecorderPtr recorder_;
39 StrongBinding<tracing::TraceProvider> binding_;
40 42
43 base::WeakPtrFactory<TraceProviderImpl> weak_factory_;
41 DISALLOW_COPY_AND_ASSIGN(TraceProviderImpl); 44 DISALLOW_COPY_AND_ASSIGN(TraceProviderImpl);
42 }; 45 };
43 46
44 } // namespace mojo 47 } // namespace mojo
45 48
46 #endif // MOJO_COMMON_TRACE_PROVIDER_IMPL_H_ 49 #endif // MOJO_COMMON_TRACE_PROVIDER_IMPL_H_
OLDNEW
« 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