OLD | NEW |
---|---|
(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_H_ | |
joedow
2017/04/24 17:16:09
fix the macro guard (REMOTING_HOST_PROCESS_STATS_S
Hzj_jie
2017/04/25 00:17:54
Done.
| |
6 #define REMOTING_HOST_PROCESS_STATS_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/host/process_stats_agent.h" | |
joedow
2017/04/24 17:16:09
ProcessStatsAgent can be forward decalared
Hzj_jie
2017/04/25 00:17:53
Done.
| |
15 #include "remoting/proto/process_stats.pb.h" | |
16 #include "remoting/protocol/process_stats_stub.h" | |
17 | |
18 namespace remoting { | |
19 | |
20 // A component to report process statistic data regularly. | |
21 class ProcessStatsSender final { | |
22 public: | |
23 // ProcessStatsSender starts immediately, and reports the statistic data to | |
joedow
2017/04/24 17:16:09
nit: remove comma and 'the'
Hzj_jie
2017/04/25 00:17:53
Done.
| |
24 // |host_stats_stub| once per |interval_|. | |
joedow
2017/04/24 17:16:09
s/interval_/interval
Hzj_jie
2017/04/25 00:17:53
Done.
| |
25 // ProcessStatsSender does not take the ownership of |host_stats_stub|. It | |
26 // must outlive the ProcessStatsSender object. | |
27 ProcessStatsSender(protocol::ProcessStatsStub* host_stats_stub, | |
28 base::TimeDelta interval); | |
29 | |
30 // ProcessStatsSender stops in destruction. The ProcessStatsSender object | |
31 // needs to be destructed on the same thread as constructing. | |
joedow
2017/04/24 17:16:09
You might want to move the thread requirements int
Hzj_jie
2017/04/25 00:17:54
Done.
| |
32 ~ProcessStatsSender(); | |
33 | |
34 void AddProcessStatsAgent(std::unique_ptr<ProcessStatsAgent> agent); | |
35 | |
36 private: | |
joedow
2017/04/24 17:16:09
Do you want a private c'tor here?
Hzj_jie
2017/04/25 00:17:53
Sorry, I do not follow. Why?
joedow
2017/04/25 15:57:28
To prevent someone from creating a uninitialized i
Hzj_jie
2017/04/25 22:19:19
Ah, that seems not necessary. An explicit construc
| |
37 void ReportUsage(); | |
38 | |
39 protocol::ProcessStatsStub* const host_stats_stub_; | |
40 const base::TimeDelta interval_; | |
41 std::vector<std::unique_ptr<ProcessStatsAgent>> agents_; | |
42 base::RepeatingTimer timer_; | |
43 base::ThreadChecker thread_checker_; | |
44 }; | |
45 | |
46 } // namespace remoting | |
47 | |
48 #endif // REMOTING_HOST_PROCESS_STATS_H_ | |
OLD | NEW |