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