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

Unified Diff: remoting/host/chromoting_host.cc

Issue 7262015: Conenct Chromoting plugin debug log to JS UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing host logging files Created 9 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
Index: remoting/host/chromoting_host.cc
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 0ebff52c6877800a9cb9c45db2bb6536be1d7d8f..3ae1ef119bbb4838e22870f3465fa870a166989b 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -6,11 +6,13 @@
#include "base/bind.h"
#include "base/callback.h"
+#include "base/logging.h"
#include "build/build_config.h"
#include "remoting/base/constants.h"
#include "remoting/base/encoder.h"
#include "remoting/base/encoder_row_based.h"
#include "remoting/base/encoder_vp8.h"
+#include "remoting/base/logger.h"
#include "remoting/host/capturer.h"
#include "remoting/host/chromoting_host_context.h"
#include "remoting/host/continue_window.h"
@@ -42,7 +44,8 @@ namespace remoting {
// static
ChromotingHost* ChromotingHost::Create(ChromotingHostContext* context,
MutableHostConfig* config,
- AccessVerifier* access_verifier) {
+ AccessVerifier* access_verifier,
+ Logger* logger) {
Capturer* capturer = Capturer::Create();
EventExecutor* event_executor =
EventExecutor::Create(context->desktop_message_loop(), capturer);
@@ -54,25 +57,29 @@ ChromotingHost* ChromotingHost::Create(ChromotingHostContext* context,
new DesktopEnvironment(capturer, event_executor, curtain,
disconnect_window, continue_window,
local_input_monitor),
- access_verifier);
+ access_verifier, logger);
}
// static
ChromotingHost* ChromotingHost::Create(ChromotingHostContext* context,
MutableHostConfig* config,
DesktopEnvironment* environment,
- AccessVerifier* access_verifier) {
- return new ChromotingHost(context, config, environment, access_verifier);
+ AccessVerifier* access_verifier,
+ Logger* logger) {
+ return new ChromotingHost(context, config, environment, access_verifier,
+ logger);
}
ChromotingHost::ChromotingHost(ChromotingHostContext* context,
MutableHostConfig* config,
DesktopEnvironment* environment,
- AccessVerifier* access_verifier)
+ AccessVerifier* access_verifier,
+ Logger* logger)
: context_(context),
config_(config),
desktop_environment_(environment),
access_verifier_(access_verifier),
+ logger_(logger),
state_(kInitial),
protocol_config_(protocol::CandidateSessionConfig::CreateDefault()),
is_curtained_(false),
@@ -91,6 +98,7 @@ void ChromotingHost::Start() {
return;
}
+ logger_->Log(logging::LOG_INFO, "Starting host");
DCHECK(!jingle_client_);
DCHECK(access_verifier_.get());
@@ -108,7 +116,8 @@ void ChromotingHost::Start() {
if (!config_->GetString(kXmppLoginConfigPath, &xmpp_login) ||
!config_->GetString(kXmppAuthTokenConfigPath, &xmpp_auth_token) ||
!config_->GetString(kXmppAuthServiceConfigPath, &xmpp_auth_service)) {
- LOG(ERROR) << "XMPP credentials are not defined in the config.";
+ logger_->Log(logging::LOG_ERROR,
+ "XMPP credentials are not defined in the config.");
return;
}
@@ -181,7 +190,7 @@ void ChromotingHost::AddStatusObserver(HostStatusObserver* observer) {
// protocol::ConnectionToClient::EventHandler implementations
void ChromotingHost::OnConnectionOpened(ConnectionToClient* connection) {
DCHECK_EQ(context_->network_message_loop(), MessageLoop::current());
- VLOG(1) << "Connection to client established.";
+ logger_->VLog(1, "Connection to client established.");
// TODO(wez): ChromotingHost shouldn't need to know about Me2Mom.
if (is_it2me_) {
context_->main_message_loop()->PostTask(
@@ -193,7 +202,7 @@ void ChromotingHost::OnConnectionOpened(ConnectionToClient* connection) {
void ChromotingHost::OnConnectionClosed(ConnectionToClient* connection) {
DCHECK_EQ(context_->network_message_loop(), MessageLoop::current());
- VLOG(1) << "Connection to client closed.";
+ logger_->VLog(1, "Connection to client closed.");
context_->main_message_loop()->PostTask(
FROM_HERE, base::Bind(&ChromotingHost::OnClientDisconnected, this,
make_scoped_refptr(connection)));
@@ -202,7 +211,7 @@ void ChromotingHost::OnConnectionClosed(ConnectionToClient* connection) {
void ChromotingHost::OnConnectionFailed(ConnectionToClient* connection) {
DCHECK_EQ(context_->network_message_loop(), MessageLoop::current());
- LOG(ERROR) << "Connection failed unexpectedly.";
+ logger_->Log(logging::LOG_ERROR, "Connection failed unexpectedly.");
context_->main_message_loop()->PostTask(
FROM_HERE, base::Bind(&ChromotingHost::OnClientDisconnected, this,
make_scoped_refptr(connection)));
@@ -232,7 +241,7 @@ void ChromotingHost::OnStateChange(JingleClient* jingle_client,
std::string jid = jingle_client->GetFullJid();
DCHECK_EQ(jingle_client_.get(), jingle_client);
- VLOG(1) << "Host connected as " << jid;
+ logger_->Log(logging::LOG_INFO, "Host connected as %s", jid.c_str());
// Create and start session manager.
protocol::JingleSessionManager* server =
@@ -256,7 +265,7 @@ void ChromotingHost::OnStateChange(JingleClient* jingle_client,
(*it)->OnSignallingConnected(signal_strategy_.get(), jid);
}
} else if (state == JingleClient::CLOSED) {
- VLOG(1) << "Host disconnected from talk network.";
+ logger_->Log(logging::LOG_INFO, "Host disconnected from talk network.");
dmac 2011/06/26 14:34:44 why did we change this from a vlog?
garykac 2011/06/27 21:24:20 Because this is info that I want to see in the UI
for (StatusObserverList::iterator it = status_observers_.begin();
it != status_observers_.end(); ++it) {
(*it)->OnSignallingDisconnected();
@@ -306,8 +315,9 @@ void ChromotingHost::OnNewClientSession(
session->candidate_config(), true /* force_host_resolution */);
if (!config) {
- LOG(WARNING) << "Rejecting connection from " << session->jid()
- << " because no compatible configuration has been found.";
+ logger_->Log(logging::LOG_WARNING,
+ "Rejecting connection from %s because no compatible"
+ " configuration has been found.", session->jid().c_str());
*response = protocol::SessionManager::INCOMPATIBLE;
return;
}
@@ -318,7 +328,8 @@ void ChromotingHost::OnNewClientSession(
*response = protocol::SessionManager::ACCEPT;
- VLOG(1) << "Client connected: " << session->jid();
+ logger_->Log(logging::LOG_INFO, "Client connected: %s",
dmac 2011/06/26 14:34:44 we did we change from a vlog?
garykac 2011/06/27 21:24:20 As above.
+ session->jid().c_str());
// We accept the connection, so create a connection object.
ConnectionToClient* connection = new ConnectionToClient(

Powered by Google App Engine
This is Rietveld 408576698