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

Side by Side Diff: services/resource_coordinator/public/cpp/tracing/chrome_agent.h

Issue 2878533003: tracing: the client lib of the tracing service (Closed)
Patch Set: review Created 3 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_TRACING_CHROME_AGENT_H_
6 #define SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_TRACING_CHROME_AGENT_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/ref_counted_memory.h"
Primiano Tucci (use gerrit) 2017/05/16 04:45:11 not sure you need this
chiniforooshan 2017/05/16 15:14:45 For base::RefCountedString.
10 #include "base/threading/thread_checker.h"
11 #include "base/values.h"
Primiano Tucci (use gerrit) 2017/05/16 04:45:11 I think you can just forward declare base::Diction
chiniforooshan 2017/05/16 15:14:45 Done.
12 #include "mojo/public/cpp/bindings/binding.h"
13 #include "services/resource_coordinator/public/cpp/resource_coordinator_export.h "
14 #include "services/resource_coordinator/public/interfaces/tracing/tracing.mojom. h"
15 #include "services/service_manager/public/cpp/connector.h"
16
17 namespace tracing {
18
19 class SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_EXPORT ChromeAgent
Primiano Tucci (use gerrit) 2017/05/16 04:45:11 Ahhhhh now I understand. this is not a generic age
chiniforooshan 2017/05/16 15:14:45 Done.
20 : public mojom::Agent {
21 public:
22 using MetadataGeneratorFunction =
23 base::RepeatingCallback<std::unique_ptr<base::DictionaryValue>()>;
24
25 static ChromeAgent* GetOrCreateInstance(
26 mojom::AgentRegistryPtr agent_registry);
27
28 void AddMetadataGeneratorFunction(MetadataGeneratorFunction generator);
29
30 private:
31 friend std::default_delete<ChromeAgent>; // For Testing
32 friend class ChromeAgentTest; // For Testing
33
34 explicit ChromeAgent(mojom::AgentRegistryPtr agent_registry);
35 ~ChromeAgent() override;
36
37 // mojom::Agent
38 void StartTracing(const std::string& config,
39 mojom::RecorderPtr recorder,
40 const StartTracingCallback& callback) override;
41 void StopAndFlush() override;
42 void RequestClockSyncMarker(
43 const std::string& sync_id,
44 const RequestClockSyncMarkerCallback& callback) override;
45 void RequestBufferStatus(
46 const RequestBufferStatusCallback& callback) override;
47 void GetCategories(const GetCategoriesCallback& callback) override;
48
49 void SendChunk(const scoped_refptr<base::RefCountedString>& events_str,
50 bool has_more_events);
51
52 mojo::Binding<mojom::Agent> binding_;
53 mojom::RecorderPtr recorder_;
54 std::vector<MetadataGeneratorFunction> metadata_generator_functions_;
55
56 base::ThreadChecker thread_checker_;
57
58 DISALLOW_COPY_AND_ASSIGN(ChromeAgent);
59 };
60
61 } // namespace tracing
62 #endif // SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_TRACING_CHROME_AGENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698