| 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_TRACING_ARC_TRACING_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_TRACING_ARC_TRACING_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_service.h" |
| 15 #include "components/arc/common/tracing.mojom.h" |
| 16 #include "components/arc/instance_holder.h" |
| 17 #include "content/browser/tracing/arc_tracing_agent.h" |
| 18 |
| 19 namespace arc { |
| 20 |
| 21 class ArcBridgeService; |
| 22 |
| 23 // This class provides the interface to trigger tracing in the container. |
| 24 class ArcTracingBridge |
| 25 : public ArcService, |
| 26 public content::ArcTracingAgent::Delegate, |
| 27 public InstanceHolder<mojom::TracingInstance>::Observer { |
| 28 public: |
| 29 explicit ArcTracingBridge(ArcBridgeService* bridge_service); |
| 30 ~ArcTracingBridge() override; |
| 31 |
| 32 // InstanceHolder<mojom::TracingInstance>::Observer overrides: |
| 33 void OnInstanceReady() override; |
| 34 |
| 35 // content::ArcTracingAgent::Delegate overrides: |
| 36 void StartTracing(const base::trace_event::TraceConfig& trace_config, |
| 37 const StartTracingCallback& callback) override; |
| 38 void StopTracing(const StopTracingCallback& callback) override; |
| 39 |
| 40 private: |
| 41 struct Category; |
| 42 |
| 43 // Callback for QueryAvailableCategories. |
| 44 void OnCategoriesReady(const std::vector<std::string>& categories); |
| 45 |
| 46 // List of available categories. |
| 47 std::vector<Category> categories_; |
| 48 |
| 49 // NOTE: Weak pointers must be invalidated before all other member variables |
| 50 // so it must be the last member. |
| 51 base::WeakPtrFactory<ArcTracingBridge> weak_ptr_factory_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(ArcTracingBridge); |
| 54 }; |
| 55 |
| 56 } // namespace arc |
| 57 |
| 58 #endif // CHROME_BROWSER_CHROMEOS_ARC_TRACING_ARC_TRACING_BRIDGE_H_ |
| OLD | NEW |