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

Unified Diff: remoting/host/daemon_process.h

Issue 2950993003: [Chromoting] Use ProcessStatsSender in DaemonProcess (daemon process) (Closed)
Patch Set: Resolve review comments Created 3 years, 6 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 | « no previous file | remoting/host/daemon_process.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/daemon_process.h
diff --git a/remoting/host/daemon_process.h b/remoting/host/daemon_process.h
index 391682a3534e1ff9a8332aad4acaa03f18185969..562b1a2de065c76597422d56a1ee2a32cf1632be 100644
--- a/remoting/host/daemon_process.h
+++ b/remoting/host/daemon_process.h
@@ -17,11 +17,14 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/process/process.h"
+#include "base/time/time.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_channel_handle.h"
#include "remoting/host/config_watcher.h"
+#include "remoting/host/current_process_stats_agent.h"
#include "remoting/host/host_status_monitor.h"
#include "remoting/host/worker_process_ipc_delegate.h"
+#include "remoting/protocol/process_stats_stub.h"
struct SerializedTransportRoute;
@@ -35,6 +38,7 @@ class AutoThreadTaskRunner;
class DesktopSession;
class HostEventLogger;
class HostStatusObserver;
+class ProcessStatsSender;
class ScreenResolution;
// This class implements core of the daemon process. It manages the networking
@@ -43,7 +47,8 @@ class ScreenResolution;
class DaemonProcess
: public ConfigWatcher::Delegate,
public HostStatusMonitor,
- public WorkerProcessIpcDelegate {
+ public WorkerProcessIpcDelegate,
+ public protocol::ProcessStatsStub {
public:
typedef std::list<DesktopSession*> DesktopSessionList;
@@ -70,6 +75,7 @@ class DaemonProcess
void OnChannelConnected(int32_t peer_pid) override;
bool OnMessageReceived(const IPC::Message& message) override;
void OnPermanentError(int exit_code) override;
+ void OnWorkerProcessStopped() override;
// Sends an IPC message to the network process. The message will be dropped
// unless the network process is connected over the IPC channel.
@@ -158,6 +164,17 @@ class DaemonProcess
// Deletes all desktop sessions.
void DeleteAllDesktopSessions();
+ // Starts to report process statistic data to network process. If |interval|
+ // is less then or equal to 0, a default non-zero value will be used.
+ void StartProcessStatsReport(base::TimeDelta interval);
+
+ // Stops sending process statistic data to network process.
+ void StopProcessStatsReport();
+
+ // ProcessStatsStub implementation.
+ void OnProcessStats(
+ const protocol::AggregatedProcessResourceUsage& usage) override;
+
// Task runner on which public methods of this class must be called.
scoped_refptr<AutoThreadTaskRunner> caller_task_runner_;
@@ -184,6 +201,20 @@ class DaemonProcess
// Writes host status updates to the system event log.
std::unique_ptr<HostEventLogger> host_event_logger_;
+ // Reports process statistic data to network process.
+ std::unique_ptr<ProcessStatsSender> stats_sender_;
+
+ // The number of StartProcessStatsReport requests received.
+ // Daemon and Network processes manages multiple desktop sessions. Some of
+ // them may request for process statistic reports. So the resource usage of
+ // daemon process and network process will be merged to each desktop session.
+ //
+ // As long as at least process statistic reports is enabled for one desktop
+ // session, daemon process should continually send the reports.
+ int process_stats_request_count_ = 0;
+
+ CurrentProcessStatsAgent current_process_stats_;
+
base::WeakPtrFactory<DaemonProcess> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(DaemonProcess);
« no previous file with comments | « no previous file | remoting/host/daemon_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698