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