| Index: components/arc/trace/arc_trace_bridge.h
|
| diff --git a/components/arc/trace/arc_trace_bridge.h b/components/arc/trace/arc_trace_bridge.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9d9ef8725b32d1653d0f5ca871d220c80ca56822
|
| --- /dev/null
|
| +++ b/components/arc/trace/arc_trace_bridge.h
|
| @@ -0,0 +1,61 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef COMPONENTS_ARC_TRACE_ARC_TRACE_BRIDGE_H_
|
| +#define COMPONENTS_ARC_TRACE_ARC_TRACE_BRIDGE_H_
|
| +
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "base/trace_event/trace_event.h"
|
| +#include "components/arc/arc_bridge_service.h"
|
| +#include "components/arc/arc_service.h"
|
| +#include "components/arc/instance_holder.h"
|
| +#include "mojo/public/cpp/bindings/binding.h"
|
| +
|
| +namespace arc {
|
| +
|
| +// This class provides the interface to trigger tracing in the container.
|
| +class ArcTraceBridge
|
| + : public ArcService,
|
| + public InstanceHolder<mojom::TraceInstance>::Observer,
|
| + public mojom::TraceHost {
|
| + public:
|
| +
|
| + // Gets the singleton of this class.
|
| + static ArcTraceBridge* Get();
|
| +
|
| + explicit ArcTraceBridge(ArcBridgeService* bridge_service);
|
| + ~ArcTraceBridge() override;
|
| +
|
| + // Callback when the bridge is ready.
|
| + void OnInstanceReady() override;
|
| +
|
| + // Starts tracing in the container.
|
| + void StartTracing(const base::trace_event::TraceConfig& trace_config);
|
| +
|
| + // Stops tracing in the container.
|
| + void StopTracing();
|
| +
|
| + private:
|
| + mojo::Binding<mojom::TraceHost> binding_;
|
| +
|
| + base::WeakPtrFactory<ArcTraceBridge> weak_ptr_factory_;
|
| +
|
| + std::vector<mojo::String> categories_;
|
| +
|
| + // Query the available categories for tracing.
|
| + void QueryAvailableCategories();
|
| +
|
| + // Callback for QueryAvailableCategories.
|
| + void OnCategoriesReady(mojo::Array<mojo::String> categories);
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ArcTraceBridge);
|
| +};
|
| +
|
| +} // namespace arc
|
| +
|
| +#endif // COMPONENTS_ARC_TRACE_ARC_TRACE_BRIDGE_H_
|
|
|