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

Unified Diff: remoting/host/process_stats_sender.cc

Issue 2964613002: [Chromoting] Deprecate AggregatedProcessResourceUsage.* (Closed)
Patch Set: Created 3 years, 6 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
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

Powered by Google App Engine
This is Rietveld 408576698