OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/protocol/process_stats_adapter.h" |
| 6 |
| 7 #include <utility> |
| 8 |
| 9 #include "base/logging.h" |
| 10 #include "remoting/base/constants.h" |
| 11 #include "remoting/proto/control.pb.h" |
| 12 #include "remoting/proto/process_stats.pb.h" |
| 13 #include "remoting/protocol/client_stub.h" |
| 14 |
| 15 namespace remoting { |
| 16 namespace protocol { |
| 17 |
| 18 ProcessStatsAdapter::ProcessStatsAdapter(ClientStub* client_stub) |
| 19 : client_stub_(client_stub) { |
| 20 DCHECK(client_stub_); |
| 21 } |
| 22 ProcessStatsAdapter::~ProcessStatsAdapter() = default; |
| 23 |
| 24 void ProcessStatsAdapter::OnProcessStats( |
| 25 const AggregatedProcessResourceUsage& usage) { |
| 26 protocol::ExtensionMessage message; |
| 27 message.set_type(kProcessStatsExtensionMessageType); |
| 28 std::string data; |
| 29 bool result = usage.SerializeToString(&data); |
| 30 DCHECK(result); |
| 31 message.set_data(std::move(data)); |
| 32 |
| 33 client_stub_->DeliverHostMessage(message); |
| 34 } |
| 35 |
| 36 } // namespace protocol |
| 37 } // namespace remoting |
OLD | NEW |