Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
|
Luis Héctor Chávez
2017/01/17 19:20:32
nit: s/2016/2017/ in all files.
Earl Ou
2017/01/18 09:13:21
Done.
| |
| 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/threading/thread_checker.h" | |
|
Yusuke Sato
2017/01/17 22:17:21
unused?
Earl Ou
2017/01/18 09:13:21
removed
| |
| 14 #include "base/trace_event/trace_event.h" | |
| 15 #include "chromeos/trace/arc_trace_agent.h" | |
| 16 #include "components/arc/arc_service.h" | |
| 17 #include "components/arc/common/trace.mojom.h" | |
| 18 #include "components/arc/instance_holder.h" | |
| 19 | |
| 20 namespace arc { | |
| 21 | |
| 22 class ArcBridgeService; | |
| 23 | |
| 24 // This class provides the interface to trigger tracing in the container. | |
| 25 class ArcTraceBridge : public ArcService, | |
| 26 public chromeos::ArcTraceAgent::Delegate, | |
| 27 public InstanceHolder<mojom::TraceInstance>::Observer { | |
| 28 public: | |
| 29 explicit ArcTraceBridge(ArcBridgeService* bridge_service); | |
| 30 ~ArcTraceBridge() override; | |
| 31 | |
| 32 // InstanceHolder<mojom::TraceInstance>::Observer overrides: | |
| 33 void OnInstanceReady() override; | |
| 34 | |
| 35 // chromeos::ArcTraceAgent::Delegate overrides: | |
| 36 void StartTracing(const base::trace_event::TraceConfig& trace_config, | |
| 37 const base::Callback<void(bool)>& callback) override; | |
| 38 void StopTracing( | |
| 39 const base::Callback<void(const std::string&)>& callback) override; | |
| 40 | |
| 41 private: | |
| 42 struct Category { | |
| 43 // The name used by Android to trigger tracing. | |
| 44 const std::string name; | |
| 45 // The full name shown in the tracing UI in chrome://tracing. | |
| 46 const std::string full_name; | |
| 47 }; | |
| 48 // Query the available categories for tracing. | |
| 49 void QueryAvailableCategories(); | |
| 50 | |
| 51 // Callback for QueryAvailableCategories. | |
| 52 void OnCategoriesReady(const std::vector<std::string>& categories); | |
|
Yusuke Sato
2017/01/17 22:17:21
const QueryAvailableCategoriesCallback& ? I think
Earl Ou
2017/01/18 09:13:21
This is the implementation of QueryAvailableCatego
| |
| 53 | |
| 54 // List of available categories. | |
| 55 std::vector<Category> categories_; | |
| 56 base::WeakPtrFactory<ArcTraceBridge> weak_ptr_factory_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(ArcTraceBridge); | |
| 59 }; | |
| 60 | |
| 61 } // namespace arc | |
| 62 | |
| 63 #endif // CHROME_BROWSER_CHROMEOS_ARC_TRACE_ARC_TRACE_BRIDGE_H_ | |
| OLD | NEW |