Chromium Code Reviews| 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 { | |
|
Daniel Erat
2017/03/13 14:46:48
can you just forward-declare this struct here and
Earl Ou
2017/03/14 01:51:19
Done.
| |
| 42 // The name used by Android to trigger tracing. | |
| 43 const std::string name; | |
| 44 // The full name shown in the tracing UI in chrome://tracing. | |
| 45 const std::string full_name; | |
| 46 }; | |
| 47 // Callback for QueryAvailableCategories. | |
| 48 void OnCategoriesReady(const std::vector<std::string>& categories); | |
| 49 | |
| 50 // List of available categories. | |
| 51 std::vector<Category> categories_; | |
| 52 | |
| 53 // NOTE: Weak pointers must be invalidated before all other member variables | |
| 54 // so it must be the last member. | |
| 55 base::WeakPtrFactory<ArcTracingBridge> weak_ptr_factory_; | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(ArcTracingBridge); | |
| 58 }; | |
| 59 | |
| 60 } // namespace arc | |
| 61 | |
| 62 #endif // CHROME_BROWSER_CHROMEOS_ARC_TRACING_ARC_TRACING_BRIDGE_H_ | |
| OLD | NEW |