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

Unified Diff: remoting/host/log_to_server.cc

Issue 9004050: Move signaling connection creation out of ChromotingHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 12 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/log_to_server.h ('k') | remoting/host/log_to_server_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/log_to_server.cc
diff --git a/remoting/host/log_to_server.cc b/remoting/host/log_to_server.cc
index 082cb13dfcd857a3dd234630028e4bda781e1a0b..7efb8dc08cf9e9a5b2f0f68a8bed3873eb78dc96 100644
--- a/remoting/host/log_to_server.cc
+++ b/remoting/host/log_to_server.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/message_loop_proxy.h"
#include "remoting/base/constants.h"
+#include "remoting/host/chromoting_host.h"
#include "remoting/host/server_log_entry.h"
#include "remoting/jingle_glue/iq_sender.h"
#include "remoting/jingle_glue/jingle_thread.h"
@@ -23,11 +24,13 @@ namespace {
const char kLogCommand[] = "log";
} // namespace
-LogToServer::LogToServer(base::MessageLoopProxy* message_loop)
- : message_loop_(message_loop) {
+LogToServer::LogToServer(SignalStrategy* signal_strategy)
+ : signal_strategy_(signal_strategy) {
+ signal_strategy_->AddListener(this);
}
LogToServer::~LogToServer() {
+ signal_strategy_->RemoveListener(this);
}
void LogToServer::LogSessionStateChange(bool connected) {
@@ -37,18 +40,13 @@ void LogToServer::LogSessionStateChange(bool connected) {
Log(*entry.get());
}
-void LogToServer::OnSignallingConnected(SignalStrategy* signal_strategy) {
- DCHECK(message_loop_->BelongsToCurrentThread());
- iq_sender_.reset(new IqSender(signal_strategy));
- SendPendingEntries();
-}
-
-void LogToServer::OnSignallingDisconnected() {
- DCHECK(message_loop_->BelongsToCurrentThread());
- iq_sender_.reset();
-}
-
-void LogToServer::OnAccessDenied() {
+void LogToServer::OnSignalStrategyStateChange(SignalStrategy::State state) {
+ if (state == SignalStrategy::CONNECTED) {
+ iq_sender_.reset(new IqSender(signal_strategy_));
+ SendPendingEntries();
+ } else if (state == SignalStrategy::DISCONNECTED) {
+ iq_sender_.reset();
+ }
}
void LogToServer::OnClientAuthenticated(const std::string& jid) {
@@ -59,18 +57,18 @@ void LogToServer::OnClientDisconnected(const std::string& jid) {
LogSessionStateChange(false);
}
+void LogToServer::OnAccessDenied() {
+}
+
void LogToServer::OnShutdown() {
}
void LogToServer::Log(const ServerLogEntry& entry) {
- DCHECK(message_loop_->BelongsToCurrentThread());
pending_entries_.push_back(entry);
SendPendingEntries();
}
void LogToServer::SendPendingEntries() {
- DCHECK(message_loop_->BelongsToCurrentThread());
-
if (iq_sender_ == NULL) {
return;
}
« no previous file with comments | « remoting/host/log_to_server.h ('k') | remoting/host/log_to_server_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698