diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-22 02:34:56 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-22 02:34:56 +0000 |
commit | 6852d7d96f3643277e8dab49e3bfa0e482aafffe (patch) | |
tree | 65b97cf15fb3cb6a60b914abac6310c9ff22e710 /remoting/protocol/client_message_dispatcher.cc | |
parent | a4f4692c776153b2b61c0a63d8b9c80e56613881 (diff) | |
download | chromium_src-6852d7d96f3643277e8dab49e3bfa0e482aafffe.zip chromium_src-6852d7d96f3643277e8dab49e3bfa0e482aafffe.tar.gz chromium_src-6852d7d96f3643277e8dab49e3bfa0e482aafffe.tar.bz2 |
Changed MessageReader so that it doesn't read from the socket if there are
other messages being processed. Added unittests for MessageReader.
BUG=None
TEST=Unittests
Review URL: http://codereview.chromium.org/6271004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72262 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol/client_message_dispatcher.cc')
-rw-r--r-- | remoting/protocol/client_message_dispatcher.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/remoting/protocol/client_message_dispatcher.cc b/remoting/protocol/client_message_dispatcher.cc index 9568685..e7b6dd6 100644 --- a/remoting/protocol/client_message_dispatcher.cc +++ b/remoting/protocol/client_message_dispatcher.cc @@ -11,7 +11,6 @@ #include "remoting/protocol/client_stub.h" #include "remoting/protocol/input_stub.h" #include "remoting/protocol/message_reader.h" -#include "remoting/protocol/ref_counted_message.h" #include "remoting/protocol/session.h" namespace remoting { @@ -39,18 +38,18 @@ void ClientMessageDispatcher::Initialize( } void ClientMessageDispatcher::OnControlMessageReceived( - ControlMessage* message) { - scoped_refptr<RefCountedMessage<ControlMessage> > ref_msg = - new RefCountedMessage<ControlMessage>(message); + ControlMessage* message, Task* done_task) { + // TODO(sergeyu): Add message validation. if (message->has_notify_resolution()) { client_stub_->NotifyResolution( - &message->notify_resolution(), NewDeleteTask(ref_msg)); + &message->notify_resolution(), done_task); } else if (message->has_begin_session_response()) { client_stub_->BeginSessionResponse( - &message->begin_session_response().login_status(), - NewDeleteTask(ref_msg)); + &message->begin_session_response().login_status(), done_task); } else { - NOTREACHED() << "Invalid control message received"; + LOG(WARNING) << "Invalid control message received."; + done_task->Run(); + delete done_task; } } |