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

Side by Side Diff: remoting/protocol/process_stats_adapter.cc

Issue 2856243002: [Chromoting] Add ProcessStatsDispatcher to send process stats to the client
Patch Set: Change ProcessStatsDispatcher into ProcessStatsAgent and send the message through ClientStub Created 3 years, 7 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 unified diff | Download patch
OLDNEW
(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(extension_message::kProcessStatsType);
28 std::string data;
29 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
30 message.set_data(std::move(data));
31
32 client_stub_->DeliverHostMessage(message);
Sergey Ulanov 2017/05/26 19:27:30 If we are using protocol extensions to send these
33 }
34
35 } // namespace protocol
36 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698