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

Unified Diff: remoting/host/host_event_logger_posix.cc

Issue 12386035: Moving host status events monitoring to a separate interface (HostStatusMonitor). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 10 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/host_event_logger.h ('k') | remoting/host/host_event_logger_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/host_event_logger_posix.cc
diff --git a/remoting/host/host_event_logger_posix.cc b/remoting/host/host_event_logger_posix.cc
index fed6203b8500888fc0f476d40379fc41d248e87d..6cd74126f4423271cdd97554eae6d0e058233195 100644
--- a/remoting/host/host_event_logger_posix.cc
+++ b/remoting/host/host_event_logger_posix.cc
@@ -4,11 +4,11 @@
#include "remoting/host/host_event_logger.h"
-#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "base/stringprintf.h"
#include "net/base/ip_endpoint.h"
-#include "remoting/host/chromoting_host.h"
+#include "remoting/host/host_status_monitor.h"
#include "remoting/host/host_status_observer.h"
#include "remoting/protocol/transport.h"
@@ -23,7 +23,7 @@ namespace {
class HostEventLoggerPosix : public HostEventLogger, public HostStatusObserver {
public:
- HostEventLoggerPosix(ChromotingHost* host,
+ HostEventLoggerPosix(base::WeakPtr<HostStatusMonitor> monitor,
const std::string& application_name);
virtual ~HostEventLoggerPosix();
@@ -43,7 +43,7 @@ class HostEventLoggerPosix : public HostEventLogger, public HostStatusObserver {
private:
void Log(const std::string& message);
- scoped_refptr<ChromotingHost> host_;
+ base::WeakPtr<HostStatusMonitor> monitor_;
std::string application_name_;
DISALLOW_COPY_AND_ASSIGN(HostEventLoggerPosix);
@@ -51,16 +51,18 @@ class HostEventLoggerPosix : public HostEventLogger, public HostStatusObserver {
} //namespace
-HostEventLoggerPosix::HostEventLoggerPosix(ChromotingHost* host,
- const std::string& application_name)
- : host_(host),
+HostEventLoggerPosix::HostEventLoggerPosix(
+ base::WeakPtr<HostStatusMonitor> monitor,
+ const std::string& application_name)
+ : monitor_(monitor),
application_name_(application_name) {
openlog(application_name_.c_str(), 0, LOG_USER);
- host_->AddStatusObserver(this);
+ monitor_->AddStatusObserver(this);
}
HostEventLoggerPosix::~HostEventLoggerPosix() {
- host_->RemoveStatusObserver(this);
+ if (monitor_)
+ monitor_->RemoveStatusObserver(this);
closelog();
}
@@ -102,9 +104,10 @@ void HostEventLoggerPosix::Log(const std::string& message) {
// static
scoped_ptr<HostEventLogger> HostEventLogger::Create(
- ChromotingHost* host, const std::string& application_name) {
+ base::WeakPtr<HostStatusMonitor> monitor,
+ const std::string& application_name) {
return scoped_ptr<HostEventLogger>(
- new HostEventLoggerPosix(host, application_name));
+ new HostEventLoggerPosix(monitor, application_name));
}
} // namespace remoting
« no previous file with comments | « remoting/host/host_event_logger.h ('k') | remoting/host/host_event_logger_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698