Chromium Code Reviews| 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 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 <utility> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 #include "base/memory/weak_ptr.h" | |
| 14 #include "base/threading/thread_checker.h" | |
| 15 #include "base/trace_event/trace_event.h" | |
| 16 #include "chromeos/dbus/arc_trace_agent.h" | |
| 17 #include "components/arc/arc_service.h" | |
| 18 #include "components/arc/common/trace.mojom.h" | |
| 19 #include "components/arc/instance_holder.h" | |
| 20 | |
| 21 namespace arc { | |
| 22 | |
| 23 class ArcBridgeService; | |
| 24 | |
| 25 // This class provides the interface to trigger tracing in the container. | |
| 26 class ArcTraceBridge : public ArcService, | |
| 27 public chromeos::ArcTraceAgent::ArcTraceBridge, | |
| 28 public InstanceHolder<mojom::TraceInstance>::Observer { | |
| 29 public: | |
| 30 // Gets the singleton of this class. | |
| 31 static ArcTraceBridge* Get(); | |
| 32 | |
| 33 explicit ArcTraceBridge(ArcBridgeService* bridge_service); | |
| 34 ~ArcTraceBridge() override; | |
| 35 | |
| 36 // InstanceHolder<mojom::TraceInstance>::Observer overrides: | |
| 37 void OnInstanceReady() 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 // Callback for StartTracing. | |
| 53 void OnTraceStart(bool success); | |
| 54 | |
| 55 // Callback for StopTracing. | |
| 56 void OnTraceStop(bool success); | |
| 57 | |
| 58 virtual void StartTracing( | |
|
Luis Héctor Chávez
2016/12/27 19:15:58
These two functions are overriden, so they should
shunhsingou
2016/12/28 09:15:15
Done.
| |
| 59 const base::trace_event::TraceConfig& trace_config); | |
| 60 | |
| 61 virtual void StopTracing(); | |
| 62 | |
| 63 base::ThreadChecker thread_checker_; | |
|
Luis Héctor Chávez
2016/12/27 19:15:58
Since you are in chrome/browser/chromeos, the pref
shunhsingou
2016/12/28 09:15:15
Done.
| |
| 64 | |
| 65 // List of available categories. | |
| 66 std::vector<Category> categories_; | |
| 67 | |
| 68 base::WeakPtrFactory<ArcTraceBridge> weak_ptr_factory_; | |
| 69 | |
| 70 DISALLOW_COPY_AND_ASSIGN(ArcTraceBridge); | |
| 71 }; | |
| 72 | |
| 73 } // namespace arc | |
| 74 | |
| 75 #endif // CHROME_BROWSER_CHROMEOS_ARC_TRACE_ARC_TRACE_BRIDGE_H_ | |
| OLD | NEW |