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

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

Issue 2427013002: Make tracing work in service manager (Closed)
Patch Set: Rename InitializeWithFactoryLocked to InitializeWithFactoryInternal Created 4 years, 2 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/service_manager/standalone/tracer.cc ('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_PROVIDER_H_ 5 #ifndef SERVICES_TRACING_PUBLIC_CPP_PROVIDER_H_
6 #define SERVICES_TRACING_PUBLIC_CPP_PROVIDER_H_ 6 #define SERVICES_TRACING_PUBLIC_CPP_PROVIDER_H_
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "mojo/public/cpp/bindings/binding.h" 12 #include "mojo/public/cpp/bindings/binding.h"
13 #include "mojo/public/cpp/bindings/interface_request.h" 13 #include "mojo/public/cpp/bindings/interface_request.h"
14 #include "services/tracing/public/interfaces/tracing.mojom.h" 14 #include "services/tracing/public/interfaces/tracing.mojom.h"
15 15
16 namespace service_manager { 16 namespace service_manager {
17 class Connector; 17 class Connector;
18 } 18 }
19 19
20 namespace tracing { 20 namespace tracing {
21 21
22 class Provider : public mojom::Provider { 22 class Provider : public mojom::Provider {
23 public: 23 public:
24 Provider(); 24 Provider();
25 ~Provider() override; 25 ~Provider() override;
26 26
27 void InitializeWithFactory(mojom::FactoryPtr* factory);
27 void Initialize(service_manager::Connector* connector, 28 void Initialize(service_manager::Connector* connector,
28 const std::string& url); 29 const std::string& url);
29 30
30 void Bind(mojom::ProviderRequest request); 31 void Bind(mojom::ProviderRequest request);
31 32
32 private: 33 private:
34 void InitializeWithFactoryInternal(mojom::FactoryPtr* factory);
35
33 // mojom::Provider implementation: 36 // mojom::Provider implementation:
34 void StartTracing(const std::string& categories, 37 void StartTracing(const std::string& categories,
35 mojom::RecorderPtr recorder) override; 38 mojom::RecorderPtr recorder) override;
36 void StopTracing() override; 39 void StopTracing() override;
37 40
38 void SendChunk(const scoped_refptr<base::RefCountedString>& events_str, 41 void SendChunk(const scoped_refptr<base::RefCountedString>& events_str,
39 bool has_more_events); 42 bool has_more_events);
40 43
41 void DelayedStop(); 44 void DelayedStop();
42 // Stop the collection of traces if no external connection asked for them yet. 45 // Stop the collection of traces if no external connection asked for them yet.
43 void StopIfForced(); 46 void StopIfForced();
44 47
45 // Enable tracing without waiting for an inbound connection. It will stop if 48 // Enable tracing without waiting for an inbound connection. It will stop if
46 // no TraceRecorder is sent within a set time. 49 // no TraceRecorder is sent within a set time.
47 void ForceEnableTracing(); 50 void ForceEnableTracing();
48 51
49 mojo::Binding<mojom::Provider> binding_; 52 mojo::Binding<mojom::Provider> binding_;
50 bool tracing_forced_; 53 bool tracing_forced_;
51 mojom::RecorderPtr recorder_; 54 mojom::RecorderPtr recorder_;
52 55
53 base::WeakPtrFactory<Provider> weak_factory_; 56 base::WeakPtrFactory<Provider> weak_factory_;
54 DISALLOW_COPY_AND_ASSIGN(Provider); 57 DISALLOW_COPY_AND_ASSIGN(Provider);
55 }; 58 };
56 59
57 } // namespace tracing 60 } // namespace tracing
58 61
59 #endif // SERVICES_TRACING_PUBLIC_CPP_PROVIDER_H_ 62 #endif // SERVICES_TRACING_PUBLIC_CPP_PROVIDER_H_
OLDNEW
« no previous file with comments | « services/service_manager/standalone/tracer.cc ('k') | services/tracing/public/cpp/provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698