OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 CHROME_BROWSER_CHROMEOS_ARC_TRACE_ARC_TRACE_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_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 "chromeos/trace/arc_trace_agent.h" |
| 15 #include "components/arc/arc_service.h" |
| 16 #include "components/arc/common/trace.mojom.h" |
| 17 #include "components/arc/instance_holder.h" |
| 18 |
| 19 namespace arc { |
| 20 |
| 21 class ArcBridgeService; |
| 22 |
| 23 // This class provides the interface to trigger tracing in the container. |
| 24 class ArcTraceBridge : public ArcService, |
| 25 public chromeos::ArcTraceAgent::Delegate, |
| 26 public InstanceHolder<mojom::TraceInstance>::Observer { |
| 27 public: |
| 28 explicit ArcTraceBridge(ArcBridgeService* bridge_service); |
| 29 ~ArcTraceBridge() override; |
| 30 |
| 31 // InstanceHolder<mojom::TraceInstance>::Observer overrides: |
| 32 void OnInstanceReady() override; |
| 33 |
| 34 // chromeos::ArcTraceAgent::Delegate overrides: |
| 35 void StartTracing(const base::trace_event::TraceConfig& trace_config, |
| 36 const StartTracingCallback& callback) override; |
| 37 void StopTracing(const StopTracingCallback& callback) override; |
| 38 |
| 39 private: |
| 40 struct Category { |
| 41 // The name used by Android to trigger tracing. |
| 42 const std::string name; |
| 43 // The full name shown in the tracing UI in chrome://tracing. |
| 44 const std::string full_name; |
| 45 }; |
| 46 // Query the available categories for tracing. |
| 47 void QueryAvailableCategories(); |
| 48 |
| 49 // Callback for QueryAvailableCategories. |
| 50 void OnCategoriesReady(const std::vector<std::string>& categories); |
| 51 |
| 52 // List of available categories. |
| 53 std::vector<Category> categories_; |
| 54 base::WeakPtrFactory<ArcTraceBridge> weak_ptr_factory_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(ArcTraceBridge); |
| 57 }; |
| 58 |
| 59 } // namespace arc |
| 60 |
| 61 #endif // CHROME_BROWSER_CHROMEOS_ARC_TRACE_ARC_TRACE_BRIDGE_H_ |
OLD | NEW |