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

Unified Diff: remoting/host/client_session.cc

Issue 2858813002: [Chromoting] Use ProcessStatsSender in host process
Patch Set: Created 3 years, 8 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/host/client_session.h ('k') | remoting/host/client_session_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/client_session.cc
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index 2edb8f985eaded1064f6be99fe474ca49da21560..1b21feeaf755d08b70347c94252392640169fe13 100644
--- a/remoting/host/client_session.cc
+++ b/remoting/host/client_session.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
+#include "base/optional.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
@@ -20,6 +21,7 @@
#include "remoting/host/host_extension_session.h"
#include "remoting/host/input_injector.h"
#include "remoting/host/mouse_shape_pump.h"
+#include "remoting/host/process_stats_sender.h"
#include "remoting/host/screen_controls.h"
#include "remoting/host/screen_resolution.h"
#include "remoting/proto/control.pb.h"
@@ -67,6 +69,7 @@ ClientSession::ClientSession(
// controls VP9 video stream color quality.
lossless_video_color_(!base::CommandLine::ForCurrentProcess()->HasSwitch(
kDisableI444SwitchName)),
+ current_process_stats_agent_("Network Process"),
weak_factory_(this) {
connection_->session()->AddPlugin(&host_experiment_session_plugin_);
connection_->SetEventHandler(this);
@@ -243,8 +246,9 @@ void ClientSession::OnConnectionAuthenticated() {
event_handler_->OnSessionAuthenticated(this);
DesktopEnvironmentOptions options = desktop_environment_options_;
- options.ApplyHostSessionOptions(HostSessionOptions(
- host_experiment_session_plugin_.configuration()));
+ const HostSessionOptions session_options(
+ host_experiment_session_plugin_.configuration());
+ options.ApplyHostSessionOptions(session_options);
// Create the desktop environment. Drop the connection if it could not be
// created for any reason (for instance the curtain could not initialize).
desktop_environment_ =
@@ -257,6 +261,30 @@ void ClientSession::OnConnectionAuthenticated() {
// Connect host stub.
connection_->set_host_stub(this);
+ if (connection_->stats_stub()) {
+ base::Optional<int> track_process_stats_interval =
+ session_options.GetInt("Track-Process-Stats-Interval");
+ // Track-Process-Stats-Interval-Ms is for testing only, usually we should
+ // not set the interval as small as one second or less.
+ base::Optional<int> track_process_stats_interval_ms =
+ session_options.GetInt("Track-Process-Stats-Interval-Ms");
+ base::TimeDelta interval;
+ if (track_process_stats_interval && *track_process_stats_interval > 0) {
+ interval = base::TimeDelta::FromSeconds(*track_process_stats_interval);
+ } else if (track_process_stats_interval_ms &&
+ *track_process_stats_interval_ms > 0) {
+ interval = base::TimeDelta::FromMilliseconds(
+ *track_process_stats_interval_ms);
+ }
+ if (interval > base::TimeDelta()) {
+ // TODO(zijiehe): Add ForwardProcessStatsAgent from DesktopEnvironment.
+ stats_sender_.reset(new ProcessStatsSender(
+ connection_->stats_stub(),
+ interval,
+ { &current_process_stats_agent_ }));
+ }
+ }
+
// Collate the set of capabilities to offer the client, if it supports them.
host_capabilities_ = desktop_environment_->GetCapabilities();
if (!host_capabilities_.empty())
@@ -360,6 +388,7 @@ void ClientSession::OnConnectionClosed(protocol::ErrorCode error) {
input_injector_.reset();
screen_controls_.reset();
desktop_environment_.reset();
+ stats_sender_.reset();
// Notify the ChromotingHost that this client is disconnected.
event_handler_->OnSessionClosed(this);
« no previous file with comments | « remoting/host/client_session.h ('k') | remoting/host/client_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698