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

Unified Diff: remoting/host/process_stats_sender.cc

Issue 2858813002: [Chromoting] Use ProcessStatsSender in host process
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/process_stats_sender.h ('k') | remoting/host/process_stats_sender_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/process_stats_sender.cc
diff --git a/remoting/host/process_stats_sender.cc b/remoting/host/process_stats_sender.cc
index a734877e51887d5c92d33ab8f1686f94ad2db2dd..2bfd4c2186f1045f4536585097d9d7af0b943cec 100644
--- a/remoting/host/process_stats_sender.cc
+++ b/remoting/host/process_stats_sender.cc
@@ -13,16 +13,31 @@
namespace remoting {
+namespace {
+
+std::vector<ProcessStatsAgent*> RemoveNullAgent(
+ std::initializer_list<ProcessStatsAgent*> agents) {
+ std::vector<ProcessStatsAgent*> result;
+ for (auto* const agent : agents) {
+ if (agent) {
+ result.push_back(agent);
+ }
+ }
+ return result;
+}
+
+} // namespace
+
ProcessStatsSender::ProcessStatsSender(
protocol::ProcessStatsStub* host_stats_stub,
base::TimeDelta interval,
std::initializer_list<ProcessStatsAgent*> agents)
: host_stats_stub_(host_stats_stub),
- agents_(agents),
+ agents_(RemoveNullAgent(agents)),
thread_checker_() {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(host_stats_stub_);
- DCHECK(!interval.is_zero());
+ DCHECK(interval > base::TimeDelta());
DCHECK(!agents_.empty());
timer_.Start(FROM_HERE, interval, this, &ProcessStatsSender::ReportUsage);
« no previous file with comments | « remoting/host/process_stats_sender.h ('k') | remoting/host/process_stats_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698