Index: remoting/protocol/jingle_session.h |
diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h |
index 0c16edfe4d84b86123d0f19887dc7ea8bd93ef71..26e2381f69617a9543c8dd02438799196941e3d6 100644 |
--- a/remoting/protocol/jingle_session.h |
+++ b/remoting/protocol/jingle_session.h |
@@ -18,6 +18,7 @@ |
#include "remoting/protocol/authenticator.h" |
#include "remoting/protocol/datagram_channel_factory.h" |
#include "remoting/protocol/jingle_messages.h" |
+#include "remoting/protocol/ordered_message_queue.h" |
#include "remoting/protocol/session.h" |
#include "remoting/protocol/session_config.h" |
#include "remoting/signaling/iq_sender.h" |
@@ -81,9 +82,15 @@ class JingleSession : public Session { |
// Called by JingleSessionManager on incoming |message|. Must call |
// |reply_callback| to send reply message before sending any other |
// messages. |
- void OnIncomingMessage(std::unique_ptr<JingleMessage> message, |
+ void OnIncomingMessage(std::string id, |
+ std::unique_ptr<JingleMessage> message, |
const ReplyCallback& reply_callback); |
+ // Called by OnIncomingMessage() to process the incoming Jingle messages |
+ // in the same order that they are sent. |
+ void OnIncomingMessageInOrder(std::unique_ptr<JingleMessage> message, |
+ const ReplyCallback& reply_callback); |
+ |
// Message handlers for incoming messages. |
void OnAccept(std::unique_ptr<JingleMessage> message, |
const ReplyCallback& reply_callback); |
@@ -135,6 +142,17 @@ class JingleSession : public Session { |
// Pending transport-info requests. |
std::list<std::unique_ptr<IqRequest>> transport_info_requests_; |
+ struct QueueItem { |
+ QueueItem(std::unique_ptr<JingleMessage> message, |
+ const ReplyCallback& reply_callback); |
+ ~QueueItem(); |
+ std::unique_ptr<JingleMessage> message; |
+ const ReplyCallback reply_callback; |
+ }; |
+ |
+ // A message queue to guarantee the incoming messages are processed in order. |
+ OrderedMessageQueue<std::unique_ptr<QueueItem>> message_queue_; |
+ |
base::WeakPtrFactory<JingleSession> weak_factory_; |
DISALLOW_COPY_AND_ASSIGN(JingleSession); |