Chromium Code Reviews| Index: remoting/protocol/process_stats_adapter.cc |
| diff --git a/remoting/protocol/process_stats_adapter.cc b/remoting/protocol/process_stats_adapter.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f0cb45dc5ef743064daa7511457611ef2b393a24 |
| --- /dev/null |
| +++ b/remoting/protocol/process_stats_adapter.cc |
| @@ -0,0 +1,36 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "remoting/protocol/process_stats_adapter.h" |
| + |
| +#include <utility> |
| + |
| +#include "base/logging.h" |
| +#include "remoting/base/constants.h" |
| +#include "remoting/proto/control.pb.h" |
| +#include "remoting/proto/process_stats.pb.h" |
| +#include "remoting/protocol/client_stub.h" |
| + |
| +namespace remoting { |
| +namespace protocol { |
| + |
| +ProcessStatsAdapter::ProcessStatsAdapter(ClientStub* client_stub) |
| + : client_stub_(client_stub) { |
| + DCHECK(client_stub_); |
| +} |
| +ProcessStatsAdapter::~ProcessStatsAdapter() = default; |
| + |
| +void ProcessStatsAdapter::OnProcessStats( |
| + const AggregatedProcessResourceUsage& usage) { |
| + protocol::ExtensionMessage message; |
| + message.set_type(extension_message::kProcessStatsType); |
| + std::string data; |
| + CHECK(usage.SerializeToString(&data)); |
|
joedow
2017/05/26 16:14:10
Should this break a release build? I think a DCHE
Sergey Ulanov
2017/05/26 19:27:30
All extension messages are serialized using JSON.
Hzj_jie
2017/05/26 20:42:16
Reasonable. Though I think there is zero reason th
|
| + message.set_data(std::move(data)); |
| + |
| + client_stub_->DeliverHostMessage(message); |
|
Sergey Ulanov
2017/05/26 19:27:30
If we are using protocol extensions to send these
|
| +} |
| + |
| +} // namespace protocol |
| +} // namespace remoting |