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

Unified Diff: chrome/browser/chromeos/arc/tracing/arc_tracing_bridge.h

Issue 2699833003: arc: enable Android tracing from chrome://tracing in dev mode (Closed)
Patch Set: Move //chromeos/tracing to //content/browser/tracing Created 3 years, 9 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
« no previous file with comments | « chrome/browser/chromeos/arc/tracing/DEPS ('k') | chrome/browser/chromeos/arc/tracing/arc_tracing_bridge.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/arc/tracing/arc_tracing_bridge.h
diff --git a/chrome/browser/chromeos/arc/tracing/arc_tracing_bridge.h b/chrome/browser/chromeos/arc/tracing/arc_tracing_bridge.h
new file mode 100644
index 0000000000000000000000000000000000000000..a554e54cdbc31f7302295e36600481952c8471a0
--- /dev/null
+++ b/chrome/browser/chromeos/arc/tracing/arc_tracing_bridge.h
@@ -0,0 +1,62 @@
+// Copyright 2017 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_TRACING_ARC_TRACING_BRIDGE_H_
+#define CHROME_BROWSER_CHROMEOS_ARC_TRACING_ARC_TRACING_BRIDGE_H_
+
+#include <string>
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "base/trace_event/trace_event.h"
+#include "components/arc/arc_service.h"
+#include "components/arc/common/tracing.mojom.h"
+#include "components/arc/instance_holder.h"
+#include "content/browser/tracing/arc_tracing_agent.h"
+
+namespace arc {
+
+class ArcBridgeService;
+
+// This class provides the interface to trigger tracing in the container.
+class ArcTracingBridge
+ : public ArcService,
+ public content::ArcTracingAgent::Delegate,
+ public InstanceHolder<mojom::TracingInstance>::Observer {
+ public:
+ explicit ArcTracingBridge(ArcBridgeService* bridge_service);
+ ~ArcTracingBridge() override;
+
+ // InstanceHolder<mojom::TracingInstance>::Observer overrides:
+ void OnInstanceReady() override;
+
+ // content::ArcTracingAgent::Delegate overrides:
+ void StartTracing(const base::trace_event::TraceConfig& trace_config,
+ const StartTracingCallback& callback) override;
+ void StopTracing(const StopTracingCallback& callback) override;
+
+ private:
+ struct Category {
Daniel Erat 2017/03/13 14:46:48 can you just forward-declare this struct here and
Earl Ou 2017/03/14 01:51:19 Done.
+ // 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;
+ };
+ // Callback for QueryAvailableCategories.
+ void OnCategoriesReady(const std::vector<std::string>& categories);
+
+ // List of available categories.
+ std::vector<Category> categories_;
+
+ // NOTE: Weak pointers must be invalidated before all other member variables
+ // so it must be the last member.
+ base::WeakPtrFactory<ArcTracingBridge> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ArcTracingBridge);
+};
+
+} // namespace arc
+
+#endif // CHROME_BROWSER_CHROMEOS_ARC_TRACING_ARC_TRACING_BRIDGE_H_
« no previous file with comments | « chrome/browser/chromeos/arc/tracing/DEPS ('k') | chrome/browser/chromeos/arc/tracing/arc_tracing_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698