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

Unified Diff: remoting/host/chromoting_param_traits.cc

Issue 2964613002: [Chromoting] Deprecate AggregatedProcessResourceUsage.* (Closed)
Patch Set: Use latest ipc_message_protobuf_utils to serialize and deserialize AggregatedProcessResourceUsage Created 3 years, 5 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/chromoting_param_traits.h ('k') | remoting/host/desktop_session_agent_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/chromoting_param_traits.cc
diff --git a/remoting/host/chromoting_param_traits.cc b/remoting/host/chromoting_param_traits.cc
index 0a5f26b372a7c96349f63f1345db4d272515a5b8..3c00ef3734d2fb6daa42276416bceab766e32c3f 100644
--- a/remoting/host/chromoting_param_traits.cc
+++ b/remoting/host/chromoting_param_traits.cc
@@ -7,6 +7,7 @@
#include <stdint.h>
#include "base/strings/stringprintf.h"
+#include "ipc/ipc_message_protobuf_utils.h"
#include "ipc/ipc_message_utils.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
@@ -281,43 +282,82 @@ void ParamTraits<remoting::DesktopEnvironmentOptions>::Log(
}
// static
-void ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::Write(
+void ParamTraits<remoting::protocol::ProcessResourceUsage>::GetSize(
+ base::PickleSizer* s, const param_type& p) {
+ GetParamSize(s, p.process_name());
+ GetParamSize(s, p.processor_usage());
+ GetParamSize(s, p.working_set_size());
+ GetParamSize(s, p.pagefile_size());
+}
+
+// static
+void ParamTraits<remoting::protocol::ProcessResourceUsage>::Write(
base::Pickle* m,
- const remoting::protocol::AggregatedProcessResourceUsage& p) {
- m->WriteString(p.name());
+ const param_type& p) {
+ m->WriteString(p.process_name());
m->WriteDouble(p.processor_usage());
m->WriteUInt64(p.working_set_size());
m->WriteUInt64(p.pagefile_size());
}
// static
-bool ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::Read(
+bool ParamTraits<remoting::protocol::ProcessResourceUsage>::Read(
const base::Pickle* m,
base::PickleIterator* iter,
- remoting::protocol::AggregatedProcessResourceUsage* p) {
- std::string name;
+ param_type* p) {
+ std::string process_name;
double processor_usage;
uint64_t working_set_size;
uint64_t pagefile_size;
- if (!iter->ReadString(&name) ||
+ if (!iter->ReadString(&process_name) ||
!iter->ReadDouble(&processor_usage) ||
!iter->ReadUInt64(&working_set_size) ||
!iter->ReadUInt64(&pagefile_size)) {
return false;
}
- p->set_name(name);
+ p->set_process_name(process_name);
p->set_processor_usage(processor_usage);
p->set_working_set_size(working_set_size);
p->set_pagefile_size(pagefile_size);
return true;
}
+// static
+void ParamTraits<remoting::protocol::ProcessResourceUsage>::Log(
+ const param_type& p,
+ std::string* l) {
+ l->append("ProcessResourceUsage(").append(p.process_name()).append(")");
+}
+
+// static
+void ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::GetSize(
+ base::PickleSizer* s, const param_type& p) {
+ GetParamSize(s, p.usages());
+}
+
+// static
+void ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::Write(
+ base::Pickle* m,
+ const param_type& p) {
+ WriteParam(m, p.usages());
+}
+
+// static
+bool ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::Read(
+ const base::Pickle* m,
+ base::PickleIterator* iter,
+ param_type* p) {
+ return ReadParam(m, iter, p->mutable_usages());
+}
+
// static
void ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::Log(
- const remoting::protocol::AggregatedProcessResourceUsage& p,
+ const param_type& p,
std::string* l) {
- l->append("AggregatedProcessResourceUsage()");
+ l->append("AggregatedProcessResourceUsage(");
+ LogParam(p.usages(), l);
+ l->append(")");
}
} // namespace IPC
« no previous file with comments | « remoting/host/chromoting_param_traits.h ('k') | remoting/host/desktop_session_agent_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698