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

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

Issue 2775983003: [Chromoting] Retrieve process resource usage (ProcessStats) and its tests (Closed)
Patch Set: Update the test case Created 3 years, 8 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 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.
22 // All public functions, including constructor and destructor of the object of
23 // ProcessStatsSender need to be executed in a same thread.
24 class ProcessStatsSender final {
25 public:
26 // ProcessStatsSender starts immediately and reports statistic data to
27 // |host_stats_stub| once per |interval|.
28 // ProcessStatsSender does not take the ownership of |host_stats_stub|. It
29 // must outlive the ProcessStatsSender object.
30 ProcessStatsSender(protocol::ProcessStatsStub* host_stats_stub,
31 base::TimeDelta interval);
32
33 // ProcessStatsSender stops in destruction.
joedow 2017/04/26 16:44:06 I don't think this comment is needed (most classes
Hzj_jie 2017/04/26 20:47:19 I have moved the comments regarding to the time of
34 ~ProcessStatsSender();
35
36 void AddProcessStatsAgent(std::unique_ptr<ProcessStatsAgent> agent);
37
38 private:
39 void ReportUsage();
40
41 protocol::ProcessStatsStub* const host_stats_stub_;
42 const base::TimeDelta interval_;
Sergey Ulanov 2017/04/26 05:42:44 I don't think you need this field. The constructor
Hzj_jie 2017/04/26 20:47:19 Oh, yes, that's for the old Start() and Stop() des
43 std::vector<std::unique_ptr<ProcessStatsAgent>> agents_;
44 base::RepeatingTimer timer_;
45 const base::ThreadChecker thread_checker_;
46 };
47
48 } // namespace remoting
49
50 #endif // REMOTING_HOST_PROCESS_STATS_SENDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698