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

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: Fix some nits Created 3 years, 10 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 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_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/files/scoped_file.h"
12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/trace_event/trace_event.h"
15 #include "chrome/browser/chromeos/arc/trace/arc_trace_reader.h"
16 #include "chromeos/trace/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 explicit ArcTraceBridge(ArcBridgeService* bridge_service);
31 ~ArcTraceBridge() override;
32
33 // InstanceHolder<mojom::TraceInstance>::Observer overrides:
34 void OnInstanceReady() override;
35
36 // chromeos::ArcTraceAgent::Delegate overrides:
37 void StartTracing(const base::trace_event::TraceConfig& trace_config,
38 const StartTracingCallback& callback) override;
39 void StopTracing(const StopTracingCallback& 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);
53
54 void OnStopTracing(const StopTracingCallback& callback, bool success);
55
56 // List of available categories.
57 std::vector<Category> categories_;
58 ArcTraceReader reader_;
59 base::WeakPtrFactory<ArcTraceBridge> weak_ptr_factory_;
60
61 DISALLOW_COPY_AND_ASSIGN(ArcTraceBridge);
62 };
63
64 } // namespace arc
65
66 #endif // CHROME_BROWSER_CHROMEOS_ARC_TRACE_ARC_TRACE_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698