OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/chromoting_param_traits.h" | 5 #include "remoting/host/chromoting_param_traits.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "ipc/ipc_message_protobuf_utils.h" |
10 #include "ipc/ipc_message_utils.h" | 11 #include "ipc/ipc_message_utils.h" |
11 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 12 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
12 | 13 |
13 namespace IPC { | 14 namespace IPC { |
14 | 15 |
15 // static | 16 // static |
16 void ParamTraits<webrtc::DesktopVector>::GetSize(base::PickleSizer* s, | 17 void ParamTraits<webrtc::DesktopVector>::GetSize(base::PickleSizer* s, |
17 const param_type& p) { | 18 const param_type& p) { |
18 GetParamSize(s, p.x()); | 19 GetParamSize(s, p.x()); |
19 GetParamSize(s, p.y()); | 20 GetParamSize(s, p.y()); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } | 275 } |
275 | 276 |
276 // static | 277 // static |
277 void ParamTraits<remoting::DesktopEnvironmentOptions>::Log( | 278 void ParamTraits<remoting::DesktopEnvironmentOptions>::Log( |
278 const remoting::DesktopEnvironmentOptions& p, | 279 const remoting::DesktopEnvironmentOptions& p, |
279 std::string* l) { | 280 std::string* l) { |
280 l->append("DesktopEnvironmentOptions()"); | 281 l->append("DesktopEnvironmentOptions()"); |
281 } | 282 } |
282 | 283 |
283 // static | 284 // static |
284 void ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::Write( | 285 void ParamTraits<remoting::protocol::ProcessResourceUsage>::GetSize( |
| 286 base::PickleSizer* s, const param_type& p) { |
| 287 GetParamSize(s, p.process_name()); |
| 288 GetParamSize(s, p.processor_usage()); |
| 289 GetParamSize(s, p.working_set_size()); |
| 290 GetParamSize(s, p.pagefile_size()); |
| 291 } |
| 292 |
| 293 // static |
| 294 void ParamTraits<remoting::protocol::ProcessResourceUsage>::Write( |
285 base::Pickle* m, | 295 base::Pickle* m, |
286 const remoting::protocol::AggregatedProcessResourceUsage& p) { | 296 const param_type& p) { |
287 m->WriteString(p.name()); | 297 m->WriteString(p.process_name()); |
288 m->WriteDouble(p.processor_usage()); | 298 m->WriteDouble(p.processor_usage()); |
289 m->WriteUInt64(p.working_set_size()); | 299 m->WriteUInt64(p.working_set_size()); |
290 m->WriteUInt64(p.pagefile_size()); | 300 m->WriteUInt64(p.pagefile_size()); |
291 } | 301 } |
292 | 302 |
293 // static | 303 // static |
294 bool ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::Read( | 304 bool ParamTraits<remoting::protocol::ProcessResourceUsage>::Read( |
295 const base::Pickle* m, | 305 const base::Pickle* m, |
296 base::PickleIterator* iter, | 306 base::PickleIterator* iter, |
297 remoting::protocol::AggregatedProcessResourceUsage* p) { | 307 param_type* p) { |
298 std::string name; | 308 std::string process_name; |
299 double processor_usage; | 309 double processor_usage; |
300 uint64_t working_set_size; | 310 uint64_t working_set_size; |
301 uint64_t pagefile_size; | 311 uint64_t pagefile_size; |
302 if (!iter->ReadString(&name) || | 312 if (!iter->ReadString(&process_name) || |
303 !iter->ReadDouble(&processor_usage) || | 313 !iter->ReadDouble(&processor_usage) || |
304 !iter->ReadUInt64(&working_set_size) || | 314 !iter->ReadUInt64(&working_set_size) || |
305 !iter->ReadUInt64(&pagefile_size)) { | 315 !iter->ReadUInt64(&pagefile_size)) { |
306 return false; | 316 return false; |
307 } | 317 } |
308 | 318 |
309 p->set_name(name); | 319 p->set_process_name(process_name); |
310 p->set_processor_usage(processor_usage); | 320 p->set_processor_usage(processor_usage); |
311 p->set_working_set_size(working_set_size); | 321 p->set_working_set_size(working_set_size); |
312 p->set_pagefile_size(pagefile_size); | 322 p->set_pagefile_size(pagefile_size); |
313 return true; | 323 return true; |
314 } | 324 } |
315 | 325 |
316 // static | 326 // static |
| 327 void ParamTraits<remoting::protocol::ProcessResourceUsage>::Log( |
| 328 const param_type& p, |
| 329 std::string* l) { |
| 330 l->append("ProcessResourceUsage(").append(p.process_name()).append(")"); |
| 331 } |
| 332 |
| 333 // static |
| 334 void ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::GetSize( |
| 335 base::PickleSizer* s, const param_type& p) { |
| 336 GetParamSize(s, p.usages()); |
| 337 } |
| 338 |
| 339 // static |
| 340 void ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::Write( |
| 341 base::Pickle* m, |
| 342 const param_type& p) { |
| 343 WriteParam(m, p.usages()); |
| 344 } |
| 345 |
| 346 // static |
| 347 bool ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::Read( |
| 348 const base::Pickle* m, |
| 349 base::PickleIterator* iter, |
| 350 param_type* p) { |
| 351 return ReadParam(m, iter, p->mutable_usages()); |
| 352 } |
| 353 |
| 354 // static |
317 void ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::Log( | 355 void ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::Log( |
318 const remoting::protocol::AggregatedProcessResourceUsage& p, | 356 const param_type& p, |
319 std::string* l) { | 357 std::string* l) { |
320 l->append("AggregatedProcessResourceUsage()"); | 358 l->append("AggregatedProcessResourceUsage("); |
| 359 LogParam(p.usages(), l); |
| 360 l->append(")"); |
321 } | 361 } |
322 | 362 |
323 } // namespace IPC | 363 } // namespace IPC |
324 | 364 |
OLD | NEW |