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

Side by Side Diff: remoting/host/process_stats_sender.h

Issue 2775983003: [Chromoting] Retrieve process resource usage (ProcessStats) and its tests (Closed)
Patch Set: thread_checker_ should be correctly constructed 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
« no previous file with comments | « remoting/host/process_stats_agent.h ('k') | remoting/host/process_stats_sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 REMOTING_HOST_PROCESS_STATS_SENDER_H_
6 #define REMOTING_HOST_PROCESS_STATS_SENDER_H_
7
8 #include <initializer_list>
9 #include <vector>
10
11 #include "base/threading/thread_checker.h"
12 #include "base/time/time.h"
13 #include "base/timer/timer.h"
14 #include "remoting/proto/process_stats.pb.h"
15 #include "remoting/protocol/process_stats_stub.h"
16
17 namespace remoting {
18
19 class ProcessStatsAgent;
20
21 // A component to report process statistic data regularly, it starts immediately
22 // after construction, and stops after destruction.
23 // All public functions, including constructor and destructor of the object of
24 // ProcessStatsSender need to be executed in a same thread.
25 class ProcessStatsSender final {
26 public:
27 // ProcessStatsSender reports statistic data to |host_stats_stub| once per
28 // |interval|.
29 // ProcessStatsSender does not take the ownership of both |host_stats_stub|
30 // and |agents|. They must outlive the ProcessStatsSender object.
31 ProcessStatsSender(protocol::ProcessStatsStub* host_stats_stub,
32 base::TimeDelta interval,
33 std::initializer_list<ProcessStatsAgent*> agents);
34
35 ~ProcessStatsSender();
36 private:
37 void ReportUsage();
38
39 protocol::ProcessStatsStub* const host_stats_stub_;
40 std::vector<ProcessStatsAgent*> agents_;
41 base::RepeatingTimer timer_;
42 const base::ThreadChecker thread_checker_;
43 };
44
45 } // namespace remoting
46
47 #endif // REMOTING_HOST_PROCESS_STATS_SENDER_H_
OLDNEW
« no previous file with comments | « remoting/host/process_stats_agent.h ('k') | remoting/host/process_stats_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698