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.
5 #ifndef MOJO_SERVICES_TRACING_TRACING_APP_H_
6 #define MOJO_SERVICES_TRACING_TRACING_APP_H_
8 #include "base/memory/scoped_vector.h"
9 #include "mojo/application/public/cpp/application_delegate.h"
10 #include "mojo/application/public/cpp/interface_factory.h"
11 #include "mojo/common/weak_binding_set.h"
12 #include "mojo/common/weak_interface_ptr_set.h"
13 #include "mojo/public/cpp/bindings/strong_binding.h"
14 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
22 : public mojo::ApplicationDelegate
,
23 public mojo::InterfaceFactory
<TraceCoordinator
>,
24 public TraceCoordinator
,
25 public mojo::InterfaceFactory
<StartupPerformanceDataCollector
>,
26 public StartupPerformanceDataCollector
{
29 ~TracingApp() override
;
32 // mojo::ApplicationDelegate implementation.
33 bool ConfigureIncomingConnection(
34 mojo::ApplicationConnection
* connection
) override
;
36 // mojo::InterfaceFactory<TraceCoordinator> implementation.
37 void Create(mojo::ApplicationConnection
* connection
,
38 mojo::InterfaceRequest
<TraceCoordinator
> request
) override
;
40 // mojo::InterfaceFactory<StartupPerformanceDataCollector> implementation.
42 mojo::ApplicationConnection
* connection
,
43 mojo::InterfaceRequest
<StartupPerformanceDataCollector
> request
) override
;
45 // TraceCoordinator implementation.
46 void Start(mojo::ScopedDataPipeProducerHandle stream
,
47 const mojo::String
& categories
) override
;
48 void StopAndFlush() override
;
50 // StartupPerformanceDataCollector implementation.
51 void SetShellProcessCreationTime(int64 time
) override
;
52 void SetBrowserMessageLoopStartTime(int64 time
) override
;
53 void SetBrowserWindowDisplayTime(int64 time
) override
;
54 void SetBrowserOpenTabsTime(int64 time
) override
;
55 void SetFirstWebContentsMainFrameLoadTime(int64 time
) override
;
56 void SetFirstVisuallyNonEmptyLayoutTime(int64 time
) override
;
57 void GetStartupPerformanceTimes(
58 const GetStartupPerformanceTimesCallback
& callback
) override
;
60 void AllDataCollected();
62 scoped_ptr
<TraceDataSink
> sink_
;
63 ScopedVector
<CollectorImpl
> collector_impls_
;
64 mojo::WeakInterfacePtrSet
<TraceController
> controller_ptrs_
;
65 mojo::WeakBindingSet
<TraceCoordinator
> coordinator_bindings_
;
66 mojo::WeakBindingSet
<StartupPerformanceDataCollector
>
67 startup_performance_data_collector_bindings_
;
68 StartupPerformanceTimes startup_performance_times_
;
70 DISALLOW_COPY_AND_ASSIGN(TracingApp
);
73 } // namespace tracing
75 #endif // MOJO_SERVICES_TRACING_TRACING_APP_H_