Index: remoting/host/process_stats_sender.cc |
diff --git a/remoting/host/process_stats_sender.cc b/remoting/host/process_stats_sender.cc |
index 8bcebb8caa881b5044d02934bd6173bd62214b7c..da2a614c9b0505c329e43088bb6985dba5820fcf 100644 |
--- a/remoting/host/process_stats_sender.cc |
+++ b/remoting/host/process_stats_sender.cc |
@@ -9,10 +9,18 @@ |
#include "base/location.h" |
#include "base/logging.h" |
#include "remoting/host/process_stats_agent.h" |
-#include "remoting/host/process_stats_util.h" |
namespace remoting { |
+namespace { |
+ |
+bool IsEmptyProcessResourceUsage(const protocol::ProcessResourceUsage& usage) { |
+ return !usage.has_process_name() && !usage.has_processor_usage() && |
joedow
2017/06/30 15:13:43
Is it ok to add a usage which is missing one of th
Hzj_jie
2017/06/30 22:39:29
Done.
|
+ !usage.has_working_set_size() && !usage.has_pagefile_size(); |
joedow
2017/06/30 15:13:43
I think the logic would be simpler if the method n
Hzj_jie
2017/06/30 22:39:29
Done.
|
+} |
+ |
+} // namespace |
+ |
ProcessStatsSender::ProcessStatsSender( |
protocol::ProcessStatsStub* host_stats_stub, |
base::TimeDelta interval, |
@@ -36,16 +44,16 @@ ProcessStatsSender::~ProcessStatsSender() { |
void ProcessStatsSender::ReportUsage() { |
DCHECK(thread_checker_.CalledOnValidThread()); |
- std::vector<protocol::ProcessResourceUsage> usages; |
+ protocol::AggregatedProcessResourceUsage aggregated; |
for (auto* const agent : agents_) { |
DCHECK(agent); |
protocol::ProcessResourceUsage usage = agent->GetResourceUsage(); |
if (!IsEmptyProcessResourceUsage(usage)) { |
- usages.push_back(std::move(usage)); |
+ *aggregated.add_usages() = usage; |
} |
} |
- host_stats_stub_->OnProcessStats(AggregateProcessResourceUsage(usages)); |
+ host_stats_stub_->OnProcessStats(aggregated); |
} |
} // namespace remoting |