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

Side by Side Diff: services/tracing/public/cpp/provider.h

Issue 2208783002: Make Tracing Service not use outgoing InterfaceProvider, update conventions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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 | « services/tracing/public/cpp/BUILD.gn ('k') | services/tracing/public/cpp/provider.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 SERVICES_TRACING_PUBLIC_CPP_TRACE_PROVIDER_IMPL_H_ 5 #ifndef SERVICES_TRACING_PUBLIC_CPP_PROVIDER_H_
6 #define SERVICES_TRACING_PUBLIC_CPP_TRACE_PROVIDER_IMPL_H_ 6 #define SERVICES_TRACING_PUBLIC_CPP_PROVIDER_H_
7 7
8 #include "base/command_line.h"
8 #include "base/macros.h" 9 #include "base/macros.h"
9 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
11 #include "mojo/public/cpp/bindings/binding.h" 12 #include "mojo/public/cpp/bindings/binding.h"
12 #include "mojo/public/cpp/bindings/interface_request.h" 13 #include "mojo/public/cpp/bindings/interface_request.h"
13 #include "services/tracing/public/interfaces/tracing.mojom.h" 14 #include "services/tracing/public/interfaces/tracing.mojom.h"
14 15
15 namespace mojo { 16 namespace shell {
17 class Connector;
18 }
16 19
17 class TraceProviderImpl : public tracing::TraceProvider { 20 namespace tracing {
21
22 class Provider : public mojom::Provider {
18 public: 23 public:
19 TraceProviderImpl(); 24 Provider();
20 ~TraceProviderImpl() override; 25 ~Provider() override;
21 26
22 void Bind(InterfaceRequest<tracing::TraceProvider> request); 27 void Initialize(shell::Connector* connector, const std::string& url);
23 28
24 // Enable tracing without waiting for an inbound connection. It will stop if 29 void Bind(mojom::ProviderRequest request);
25 // no TraceRecorder is sent within a set time.
26 void ForceEnableTracing();
27 30
28 private: 31 private:
29 // tracing::TraceProvider implementation: 32 // mojom::Provider implementation:
30 void StartTracing(const String& categories, 33 void StartTracing(const std::string& categories,
31 tracing::TraceRecorderPtr recorder) override; 34 mojom::RecorderPtr recorder) override;
32 void StopTracing() override; 35 void StopTracing() override;
33 36
34 void SendChunk(const scoped_refptr<base::RefCountedString>& events_str, 37 void SendChunk(const scoped_refptr<base::RefCountedString>& events_str,
35 bool has_more_events); 38 bool has_more_events);
36 39
37 void DelayedStop(); 40 void DelayedStop();
38 // Stop the collection of traces if no external connection asked for them yet. 41 // Stop the collection of traces if no external connection asked for them yet.
39 void StopIfForced(); 42 void StopIfForced();
40 43
41 Binding<tracing::TraceProvider> binding_; 44 // Enable tracing without waiting for an inbound connection. It will stop if
45 // no TraceRecorder is sent within a set time.
46 void ForceEnableTracing();
47
48 mojo::Binding<mojom::Provider> binding_;
42 bool tracing_forced_; 49 bool tracing_forced_;
43 tracing::TraceRecorderPtr recorder_; 50 mojom::RecorderPtr recorder_;
44 51
45 base::WeakPtrFactory<TraceProviderImpl> weak_factory_; 52 base::WeakPtrFactory<Provider> weak_factory_;
46 DISALLOW_COPY_AND_ASSIGN(TraceProviderImpl); 53 DISALLOW_COPY_AND_ASSIGN(Provider);
47 }; 54 };
48 55
49 } // namespace mojo 56 } // namespace tracing
50 57
51 #endif // SERVICES_TRACING_PUBLIC_CPP_TRACE_PROVIDER_IMPL_H_ 58 #endif // SERVICES_TRACING_PUBLIC_CPP_PROVIDER_H_
OLDNEW
« no previous file with comments | « services/tracing/public/cpp/BUILD.gn ('k') | services/tracing/public/cpp/provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698