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

Unified Diff: components/arc/trace/arc_trace_bridge.h

Issue 2400163003: arc: enable Android tracing in verified-boot mode (Closed)
Patch Set: arc: enable Android framework tracing in chrome://tracing Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: components/arc/trace/arc_trace_bridge.h
diff --git a/components/arc/trace/arc_trace_bridge.h b/components/arc/trace/arc_trace_bridge.h
new file mode 100644
index 0000000000000000000000000000000000000000..9957a34dc3da98a3fd1840b287fd8e51cd27db29
--- /dev/null
+++ b/components/arc/trace/arc_trace_bridge.h
@@ -0,0 +1,72 @@
+// 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 COMPONENTS_ARC_TRACE_ARC_TRACE_BRIDGE_H_
+#define COMPONENTS_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 "components/arc/arc_bridge_service.h"
+#include "components/arc/arc_service.h"
+#include "components/arc/instance_holder.h"
+#include "mojo/public/cpp/bindings/binding.h"
+
+namespace arc {
+
+// This class provides the interface to trigger tracing in the container.
+class ArcTraceBridge : public ArcService,
+ public InstanceHolder<mojom::TraceInstance>::Observer,
+ public mojom::TraceHost {
+ public:
+ // Gets the singleton of this class.
+ static ArcTraceBridge* Get();
+
+ explicit ArcTraceBridge(ArcBridgeService* bridge_service);
+ ~ArcTraceBridge() override;
+
+ // Callback when the bridge is ready.
+ void OnInstanceReady() override;
+
+ // Starts tracing in the container.
+ void StartTracing(const base::trace_event::TraceConfig& trace_config);
+
+ // Stops tracing in the container.
+ void StopTracing();
+
+ private:
+ mojo::Binding<mojom::TraceHost> binding_;
+
+ base::WeakPtrFactory<ArcTraceBridge> weak_ptr_factory_;
+
+ base::ThreadChecker thread_checker_;
+
+ // List of available categories name. Each item is a pair of string. The
+ // first string is the category name, and the second string is the full name
+ // shown in the trace menu UI.
+ std::vector<std::pair<std::string, std::string>> categories_;
Luis Héctor Chávez 2016/10/11 13:13:03 can you create a struct to hold both strings? that
shunhsingou 2016/10/12 04:24:26 Done.
+
+ // Query the available categories for tracing.
+ void QueryAvailableCategories();
+
+ // Callback for QueryAvailableCategories.
+ void OnCategoriesReady(mojo::Array<mojo::String> categories);
+
+ // Callback for StartTracing.
+ void OnTraceStart(bool success);
+
+ // Callback for StopTracing.
+ void OnTraceStop(bool success);
+
+ DISALLOW_COPY_AND_ASSIGN(ArcTraceBridge);
+};
+
+} // namespace arc
+
+#endif // COMPONENTS_ARC_TRACE_ARC_TRACE_BRIDGE_H_

Powered by Google App Engine
This is Rietveld 408576698