Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: chrome/browser/chromeos/arc/trace/arc_trace_bridge.h

Issue 2400163003: arc: enable Android tracing in verified-boot mode (Closed)
Patch Set: add FakeArcTraceAgent for linux and test Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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::Delegate,
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 // chromeos::ArcTraceAgent::Delegate overrides:
40 void StartTracing(
41 const base::trace_event::TraceConfig& trace_config) override;
42 void StopTracing() override;
43
44 private:
45 struct Category {
46 // The name used by Android to trigger tracing.
47 const std::string name;
48 // The full name shown in the tracing UI in chrome://tracing.
49 const std::string full_name;
50 };
51 // Query the available categories for tracing.
52 void QueryAvailableCategories();
53
54 // Callback for QueryAvailableCategories.
55 void OnCategoriesReady(const std::vector<std::string>& categories);
56
57 // Callback for StartTracing.
58 void OnTraceStart(bool success);
59
60 // Callback for StopTracing.
61 void OnTraceStop(bool success);
62
63 // List of available categories.
64 std::vector<Category> categories_;
65
66 base::WeakPtrFactory<ArcTraceBridge> weak_ptr_factory_;
67
68 DISALLOW_COPY_AND_ASSIGN(ArcTraceBridge);
69 };
70
71 } // namespace arc
72
73 #endif // CHROME_BROWSER_CHROMEOS_ARC_TRACE_ARC_TRACE_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698