Chromium Code Reviews| 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..ac63273254419e7242258477cec2394ddcf51e4e |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/arc/trace/arc_trace_bridge.h |
| @@ -0,0 +1,63 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
|
Luis Héctor Chávez
2017/01/17 19:20:32
nit: s/2016/2017/ in all files.
Earl Ou
2017/01/18 09:13:21
Done.
|
| +// 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 <vector> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/threading/thread_checker.h" |
|
Yusuke Sato
2017/01/17 22:17:21
unused?
Earl Ou
2017/01/18 09:13:21
removed
|
| +#include "base/trace_event/trace_event.h" |
| +#include "chromeos/trace/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: |
| + 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, |
| + const base::Callback<void(bool)>& callback) override; |
| + void StopTracing( |
| + const base::Callback<void(const std::string&)>& callback) 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); |
|
Yusuke Sato
2017/01/17 22:17:21
const QueryAvailableCategoriesCallback& ? I think
Earl Ou
2017/01/18 09:13:21
This is the implementation of QueryAvailableCatego
|
| + |
| + // 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_ |