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_TRACING_APP_H_ | |
6 #define SERVICES_TRACING_TRACING_APP_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <memory> | |
11 | |
12 #include "base/macros.h" | |
13 #include "base/memory/scoped_vector.h" | |
14 #include "mojo/public/cpp/bindings/binding_set.h" | |
15 #include "mojo/public/cpp/bindings/interface_ptr_set.h" | |
16 #include "mojo/public/cpp/bindings/strong_binding.h" | |
17 #include "services/shell/public/cpp/interface_factory.h" | |
18 #include "services/shell/public/cpp/service.h" | |
19 #include "services/tracing/public/interfaces/tracing.mojom.h" | |
20 #include "services/tracing/trace_data_sink.h" | |
21 #include "services/tracing/trace_recorder_impl.h" | |
22 | |
23 namespace tracing { | |
24 | |
25 class TracingApp | |
26 : public shell::Service, | |
27 public shell::InterfaceFactory<TraceCollector>, | |
28 public TraceCollector, | |
29 public shell::InterfaceFactory<StartupPerformanceDataCollector>, | |
30 public StartupPerformanceDataCollector { | |
31 public: | |
32 TracingApp(); | |
33 ~TracingApp() override; | |
34 | |
35 private: | |
36 // shell::Service implementation. | |
37 bool OnConnect(shell::Connection* connection) override; | |
38 bool OnStop() override; | |
39 | |
40 // shell::InterfaceFactory<TraceCollector> implementation. | |
41 void Create(const shell::Identity& remote_identity, | |
42 mojo::InterfaceRequest<TraceCollector> request) override; | |
43 | |
44 // shell::InterfaceFactory<StartupPerformanceDataCollector> implementation. | |
45 void Create( | |
46 const shell::Identity& remote_identity, | |
47 mojo::InterfaceRequest<StartupPerformanceDataCollector> request) override; | |
48 | |
49 // tracing::TraceCollector implementation. | |
50 void Start(mojo::ScopedDataPipeProducerHandle stream, | |
51 const mojo::String& categories) override; | |
52 void StopAndFlush() override; | |
53 | |
54 // StartupPerformanceDataCollector implementation. | |
55 void SetShellProcessCreationTime(int64_t time) override; | |
56 void SetShellMainEntryPointTime(int64_t time) override; | |
57 void SetBrowserMessageLoopStartTicks(int64_t ticks) override; | |
58 void SetBrowserWindowDisplayTicks(int64_t ticks) override; | |
59 void SetBrowserOpenTabsTimeDelta(int64_t delta) override; | |
60 void SetFirstWebContentsMainFrameLoadTicks(int64_t ticks) override; | |
61 void SetFirstVisuallyNonEmptyLayoutTicks(int64_t ticks) override; | |
62 void GetStartupPerformanceTimes( | |
63 const GetStartupPerformanceTimesCallback& callback) override; | |
64 | |
65 void AllDataCollected(); | |
66 | |
67 std::unique_ptr<TraceDataSink> sink_; | |
68 ScopedVector<TraceRecorderImpl> recorder_impls_; | |
69 mojo::InterfacePtrSet<TraceProvider> provider_ptrs_; | |
70 mojo::Binding<TraceCollector> collector_binding_; | |
71 mojo::BindingSet<StartupPerformanceDataCollector> | |
72 startup_performance_data_collector_bindings_; | |
73 StartupPerformanceTimes startup_performance_times_; | |
74 bool tracing_active_; | |
75 mojo::String tracing_categories_; | |
76 | |
77 DISALLOW_COPY_AND_ASSIGN(TracingApp); | |
78 }; | |
79 | |
80 } // namespace tracing | |
81 | |
82 #endif // SERVICES_TRACING_TRACING_APP_H_ | |
OLD | NEW |