From d6e6d13cb35c8e1dabd3eca5d03cf5d2c84abf54 Mon Sep 17 00:00:00 2001 From: "sergeyu@chromium.org" Date: Wed, 27 Oct 2010 19:11:44 +0000 Subject: Cleanups in the chromotocol code. 1) Renamed ChromotingServer to ChromotocolServer. 2) Renamed ChromotingConnection to ChromotocolConnection. 3) Added documentation for ChromotocolServer. 4) Fixed methods names in ChromtocolConnection. 5) Removed some unncessary references to media/*. BUG=None TEST=None Review URL: http://codereview.chromium.org/4105002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64113 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/protocol/protocol_test_client.cc | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'remoting/protocol/protocol_test_client.cc') diff --git a/remoting/protocol/protocol_test_client.cc b/remoting/protocol/protocol_test_client.cc index 946931a..8113db7 100644 --- a/remoting/protocol/protocol_test_client.cc +++ b/remoting/protocol/protocol_test_client.cc @@ -24,7 +24,7 @@ extern "C" { #include "remoting/base/constants.h" #include "remoting/jingle_glue/jingle_client.h" #include "remoting/jingle_glue/jingle_thread.h" -#include "remoting/protocol/jingle_chromoting_server.h" +#include "remoting/protocol/jingle_chromotocol_server.h" using remoting::kChromotingTokenServiceName; @@ -51,13 +51,13 @@ class ProtocolTestConnection closed_event_(true, false) { } - void Init(ChromotingConnection* connection); + void Init(ChromotocolConnection* connection); void Write(const std::string& str); void Read(); void Close(); - // ChromotingConnection::Callback interface. - virtual void OnStateChange(ChromotingConnection::State state); + // ChromotocolConnection::Callback interface. + virtual void OnStateChange(ChromotocolConnection::State state); private: void DoWrite(scoped_refptr buf, int size); void DoRead(); @@ -71,7 +71,7 @@ class ProtocolTestConnection ProtocolTestClient* client_; MessageLoop* message_loop_; - scoped_refptr connection_; + scoped_refptr connection_; net::CompletionCallbackImpl write_cb_; bool pending_write_; net::CompletionCallbackImpl read_cb_; @@ -97,10 +97,10 @@ class ProtocolTestClient // JingleClient::Callback interface. virtual void OnStateChange(JingleClient* client, JingleClient::State state); - // callback for JingleChromotingServer interface. + // callback for JingleChromotocolServer interface. virtual void OnNewChromotocolConnection( - ChromotingConnection* connection, - ChromotingServer::NewConnectionResponse* response); + ChromotocolConnection* connection, + ChromotocolServer::IncomingConnectionResponse* response); private: typedef std::list > ConnectionsList; @@ -110,14 +110,14 @@ class ProtocolTestClient std::string host_jid_; scoped_refptr client_; - scoped_refptr server_; + scoped_refptr server_; ConnectionsList connections_; Lock connections_lock_; base::WaitableEvent closed_event_; }; -void ProtocolTestConnection::Init(ChromotingConnection* connection) { +void ProtocolTestConnection::Init(ChromotocolConnection* connection) { connection_ = connection; } @@ -139,7 +139,7 @@ void ProtocolTestConnection::DoWrite( return; } - net::Socket* channel = connection_->GetEventChannel(); + net::Socket* channel = connection_->event_channel(); if (channel != NULL) { int result = channel->Write(buf, size, &write_cb_); if (result < 0) { @@ -162,7 +162,7 @@ void ProtocolTestConnection::Read() { void ProtocolTestConnection::DoRead() { read_buffer_ = new net::IOBuffer(kBufferSize); while (true) { - int result = connection_->GetEventChannel()->Read( + int result = connection_->event_channel()->Read( read_buffer_, kBufferSize, &read_cb_); if (result < 0) { if (result != net::ERR_IO_PENDING) @@ -185,12 +185,12 @@ void ProtocolTestConnection::OnFinishedClosing() { } void ProtocolTestConnection::OnStateChange( - ChromotingConnection::State state) { + ChromotocolConnection::State state) { LOG(INFO) << "State of " << connection_->jid() << " changed to " << state; - if (state == ChromotingConnection::CONNECTED) { + if (state == ChromotocolConnection::CONNECTED) { // Start reading after we've connected. Read(); - } else if (state == ChromotingConnection::CLOSED) { + } else if (state == ChromotocolConnection::CLOSED) { std::cerr << "Connection to " << connection_->jid() << " closed" << std::endl; client_->OnConnectionClosed(this); @@ -226,7 +226,7 @@ void ProtocolTestClient::Run(const std::string& username, client_ = new JingleClient(&jingle_thread); client_->Init(username, auth_token, kChromotingTokenServiceName, this); - server_ = new JingleChromotingServer(jingle_thread.message_loop()); + server_ = new JingleChromotocolServer(&jingle_thread); host_jid_ = host_jid; @@ -296,12 +296,12 @@ void ProtocolTestClient::OnStateChange( } void ProtocolTestClient::OnNewChromotocolConnection( - ChromotingConnection* connection, - ChromotingServer::NewConnectionResponse* response) { + ChromotocolConnection* connection, + ChromotocolServer::IncomingConnectionResponse* response) { std::cerr << "Accepting connection from " << connection->jid() << std::endl; connection->set_config(ChromotocolConfig::CreateDefault()); - *response = ChromotingServer::ACCEPT; + *response = ChromotocolServer::ACCEPT; ProtocolTestConnection* test_connection = new ProtocolTestConnection(this, client_->message_loop()); -- cgit v1.1