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

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

Issue 2775983003: [Chromoting] Retrieve process resource usage (ProcessStats) and its tests (Closed)
Patch Set: Resolve review comments 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 <memory>
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 before destruction.
joedow 2017/04/26 23:48:02 s/before/after The class stops when the d'tor is
Hzj_jie 2017/04/27 02:21:34 Done.
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 |host_stats_stub|. It
30 // must outlive the ProcessStatsSender object.
31 ProcessStatsSender(protocol::ProcessStatsStub* host_stats_stub,
32 base::TimeDelta interval);
33
34 ~ProcessStatsSender();
35
36 // Add a new ProcessStatsAgent. Users should call this function at least once
37 // immediately after constructor in the same thread.
38 void AddProcessStatsAgent(std::unique_ptr<ProcessStatsAgent> agent);
39
40 private:
41 void ReportUsage();
42
43 protocol::ProcessStatsStub* const host_stats_stub_;
44 std::vector<std::unique_ptr<ProcessStatsAgent>> agents_;
45 base::RepeatingTimer timer_;
46 const base::ThreadChecker thread_checker_;
47 };
48
49 } // namespace remoting
50
51 #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