OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 COMPONENTS_ARC_TRACE_ARC_TRACE_BRIDGE_H_ |
| 6 #define COMPONENTS_ARC_TRACE_ARC_TRACE_BRIDGE_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/trace_event/trace_event.h" |
| 14 #include "components/arc/arc_bridge_service.h" |
| 15 #include "components/arc/arc_service.h" |
| 16 #include "components/arc/instance_holder.h" |
| 17 #include "mojo/public/cpp/bindings/binding.h" |
| 18 |
| 19 namespace arc { |
| 20 |
| 21 // This class provides the interface to trigger tracing in the container. |
| 22 class ArcTraceBridge |
| 23 : public ArcService, |
| 24 public InstanceHolder<mojom::TraceInstance>::Observer, |
| 25 public mojom::TraceHost { |
| 26 public: |
| 27 |
| 28 // Gets the singleton of this class. |
| 29 static ArcTraceBridge* Get(); |
| 30 |
| 31 explicit ArcTraceBridge(ArcBridgeService* bridge_service); |
| 32 ~ArcTraceBridge() override; |
| 33 |
| 34 // Callback when the bridge is ready. |
| 35 void OnInstanceReady() override; |
| 36 |
| 37 // Starts tracing in the container. |
| 38 void StartTracing(const base::trace_event::TraceConfig& trace_config); |
| 39 |
| 40 // Stops tracing in the container. |
| 41 void StopTracing(); |
| 42 |
| 43 private: |
| 44 mojo::Binding<mojom::TraceHost> binding_; |
| 45 |
| 46 base::WeakPtrFactory<ArcTraceBridge> weak_ptr_factory_; |
| 47 |
| 48 std::vector<mojo::String> categories_; |
| 49 |
| 50 // Query the available categories for tracing. |
| 51 void QueryAvailableCategories(); |
| 52 |
| 53 // Callback for QueryAvailableCategories. |
| 54 void OnCategoriesReady(mojo::Array<mojo::String> categories); |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(ArcTraceBridge); |
| 57 }; |
| 58 |
| 59 } // namespace arc |
| 60 |
| 61 #endif // COMPONENTS_ARC_TRACE_ARC_TRACE_BRIDGE_H_ |
OLD | NEW |