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

Unified 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 4 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/arc/trace/arc_trace_bridge.h
diff --git a/chrome/browser/chromeos/arc/trace/arc_trace_bridge.h b/chrome/browser/chromeos/arc/trace/arc_trace_bridge.h
new file mode 100644
index 0000000000000000000000000000000000000000..7af077c9d5b9235ee53e5198367f334d5ce7409f
--- /dev/null
+++ b/chrome/browser/chromeos/arc/trace/arc_trace_bridge.h
@@ -0,0 +1,73 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_ARC_TRACE_ARC_TRACE_BRIDGE_H_
+#define CHROME_BROWSER_CHROMEOS_ARC_TRACE_ARC_TRACE_BRIDGE_H_
+
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "base/threading/thread_checker.h"
+#include "base/trace_event/trace_event.h"
+#include "chromeos/dbus/arc_trace_agent.h"
+#include "components/arc/arc_service.h"
+#include "components/arc/common/trace.mojom.h"
+#include "components/arc/instance_holder.h"
+
+namespace arc {
+
+class ArcBridgeService;
+
+// This class provides the interface to trigger tracing in the container.
+class ArcTraceBridge : public ArcService,
+ public chromeos::ArcTraceAgent::Delegate,
+ public InstanceHolder<mojom::TraceInstance>::Observer {
+ public:
+ // Gets the singleton of this class.
+ static ArcTraceBridge* Get();
+
+ explicit ArcTraceBridge(ArcBridgeService* bridge_service);
+ ~ArcTraceBridge() override;
+
+ // InstanceHolder<mojom::TraceInstance>::Observer overrides:
+ void OnInstanceReady() override;
+
+ // chromeos::ArcTraceAgent::Delegate overrides:
+ void StartTracing(
+ const base::trace_event::TraceConfig& trace_config) override;
+ void StopTracing() override;
+
+ private:
+ struct Category {
+ // The name used by Android to trigger tracing.
+ const std::string name;
+ // The full name shown in the tracing UI in chrome://tracing.
+ const std::string full_name;
+ };
+ // Query the available categories for tracing.
+ void QueryAvailableCategories();
+
+ // Callback for QueryAvailableCategories.
+ void OnCategoriesReady(const std::vector<std::string>& categories);
+
+ // Callback for StartTracing.
+ void OnTraceStart(bool success);
+
+ // Callback for StopTracing.
+ void OnTraceStop(bool success);
+
+ // List of available categories.
+ std::vector<Category> categories_;
+
+ base::WeakPtrFactory<ArcTraceBridge> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ArcTraceBridge);
+};
+
+} // namespace arc
+
+#endif // CHROME_BROWSER_CHROMEOS_ARC_TRACE_ARC_TRACE_BRIDGE_H_

Powered by Google App Engine
This is Rietveld 408576698