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

Unified Diff: remoting/protocol/process_stats_adapter.cc

Issue 2856243002: [Chromoting] Add ProcessStatsDispatcher to send process stats to the client
Patch Set: Partially resolve the review comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/process_stats_adapter.h ('k') | remoting/protocol/process_stats_stub.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..653b47e4a8eeee7af4459c241a58bedfa62fac51
--- /dev/null
+++ b/remoting/protocol/process_stats_adapter.cc
@@ -0,0 +1,37 @@
+// 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(kProcessStatsExtensionMessageType);
+ std::string data;
+ bool result = usage.SerializeToString(&data);
+ DCHECK(result);
+ message.set_data(std::move(data));
+
+ client_stub_->DeliverHostMessage(message);
+}
+
+} // namespace protocol
+} // namespace remoting
« no previous file with comments | « remoting/protocol/process_stats_adapter.h ('k') | remoting/protocol/process_stats_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698