Index: services/resource_coordinator/public/cpp/tracing/trace_event_agent.h |
diff --git a/services/resource_coordinator/public/cpp/tracing/trace_event_agent.h b/services/resource_coordinator/public/cpp/tracing/trace_event_agent.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..783cdb6b502f8aa9a536888e680f69e7d9f36109 |
--- /dev/null |
+++ b/services/resource_coordinator/public/cpp/tracing/trace_event_agent.h |
@@ -0,0 +1,61 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
Primiano Tucci (use gerrit)
2017/05/11 15:31:07
is this "agent" going also to subsume the other ba
chiniforooshan
2017/05/15 20:44:12
It's going to be a special base::trace_event::Trac
Primiano Tucci (use gerrit)
2017/05/16 04:45:11
tracing::ChromeAgent SGTM (or if you want even jus
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_TRACING_TRACE_EVENT_AGENT_H_ |
+#define SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_TRACING_TRACE_EVENT_AGENT_H_ |
+ |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/ref_counted_memory.h" |
+#include "base/values.h" |
+#include "mojo/public/cpp/bindings/binding.h" |
+#include "services/resource_coordinator/public/cpp/resource_coordinator_export.h" |
+#include "services/resource_coordinator/public/interfaces/tracing/tracing.mojom.h" |
+#include "services/service_manager/public/cpp/connector.h" |
+ |
+namespace resource_coordinator { |
Primiano Tucci (use gerrit)
2017/05/11 15:31:07
i wonder if we should just keep this simple and ju
chiniforooshan
2017/05/15 20:44:12
Done.
|
+namespace tracing { |
+ |
+class SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_EXPORT TraceEventAgent |
+ : public mojom::Agent { |
+ public: |
+ typedef base::RepeatingCallback<std::unique_ptr<base::DictionaryValue>()> |
Primiano Tucci (use gerrit)
2017/05/11 15:31:07
small nit: using MetadataGenerator = base...
seems
chiniforooshan
2017/05/15 20:44:12
Done.
|
+ MetadataGenerator; |
+ |
+ static TraceEventAgent* GetOrCreateInstance(mojom::AgentSetPtr agent_set); |
Primiano Tucci (use gerrit)
2017/05/11 15:31:07
can you add a comment on what the argument is for?
chiniforooshan
2017/05/15 20:44:12
Done.
|
+ |
+ void AddMetadataGenerator(MetadataGenerator generator); |
+ |
+ private: |
+ friend std::default_delete<TraceEventAgent>; // For Testing |
+ friend class TraceEventAgentTest; // For Testing |
+ |
+ explicit TraceEventAgent(mojom::AgentSetPtr agent_set); |
+ ~TraceEventAgent() override; |
+ |
+ // mojom::Agent |
+ void StartTracing(const std::string& config, |
+ mojom::RecorderPtr recorder, |
+ bool report_categories_only, |
+ const StartTracingCallback& callback) override; |
+ void StopAndFlush() override; |
+ void RequestClockSyncMarker( |
+ const std::string& sync_id, |
+ const RequestClockSyncMarkerCallback& callback) override; |
+ void RequestBufferStatus( |
+ const RequestBufferStatusCallback& callback) override; |
+ |
+ void SendChunk(const scoped_refptr<base::RefCountedString>& events_str, |
+ bool has_more_events); |
+ |
+ mojo::Binding<mojom::Agent> binding_; |
+ mojom::RecorderPtr recorder_; |
+ bool report_categories_only_; |
+ std::vector<MetadataGenerator> metadata_generators_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TraceEventAgent); |
+}; |
+ |
+} // namespace tracing |
+} // namespace resource_coordinator |
+#endif // SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_TRACING_TRACE_EVENT_AGENT_H_ |