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

Side by Side Diff: remoting/protocol/jingle_session.h

Issue 2417913002: Process incoming IQs in the same order that they were sent. (Closed)
Patch Set: Reviewer's feedback Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | remoting/protocol/jingle_session.cc » ('j') | remoting/protocol/jingle_session.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_PROTOCOL_JINGLE_SESSION_H_ 5 #ifndef REMOTING_PROTOCOL_JINGLE_SESSION_H_
6 #define REMOTING_PROTOCOL_JINGLE_SESSION_H_ 6 #define REMOTING_PROTOCOL_JINGLE_SESSION_H_
7 7
8 #include <list> 8 #include <list>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
15 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
16 #include "crypto/rsa_private_key.h" 16 #include "crypto/rsa_private_key.h"
17 #include "net/base/completion_callback.h" 17 #include "net/base/completion_callback.h"
18 #include "remoting/protocol/authenticator.h" 18 #include "remoting/protocol/authenticator.h"
19 #include "remoting/protocol/datagram_channel_factory.h" 19 #include "remoting/protocol/datagram_channel_factory.h"
20 #include "remoting/protocol/jingle_messages.h" 20 #include "remoting/protocol/jingle_messages.h"
21 #include "remoting/protocol/ordered_message_queue.h"
21 #include "remoting/protocol/session.h" 22 #include "remoting/protocol/session.h"
22 #include "remoting/protocol/session_config.h" 23 #include "remoting/protocol/session_config.h"
23 #include "remoting/signaling/iq_sender.h" 24 #include "remoting/signaling/iq_sender.h"
24 25
25 namespace remoting { 26 namespace remoting {
26 namespace protocol { 27 namespace protocol {
27 28
28 class JingleSessionManager; 29 class JingleSessionManager;
29 class Transport; 30 class Transport;
30 31
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 const buzz::XmlElement* response); 75 const buzz::XmlElement* response);
75 76
76 // Response handler for transport-info responses. Transport-info timeouts are 77 // Response handler for transport-info responses. Transport-info timeouts are
77 // ignored and don't terminate connection. 78 // ignored and don't terminate connection.
78 void OnTransportInfoResponse(IqRequest* request, 79 void OnTransportInfoResponse(IqRequest* request,
79 const buzz::XmlElement* response); 80 const buzz::XmlElement* response);
80 81
81 // Called by JingleSessionManager on incoming |message|. Must call 82 // Called by JingleSessionManager on incoming |message|. Must call
82 // |reply_callback| to send reply message before sending any other 83 // |reply_callback| to send reply message before sending any other
83 // messages. 84 // messages.
84 void OnIncomingMessage(std::unique_ptr<JingleMessage> message, 85 void OnIncomingMessage(std::string id,
Sergey Ulanov 2016/10/19 21:23:39 const reference please
kelvinp 2016/10/21 00:26:03 Done.
86 std::unique_ptr<JingleMessage> message,
85 const ReplyCallback& reply_callback); 87 const ReplyCallback& reply_callback);
86 88
89 // Called by OnIncomingMessage() to process the incoming Jingle messages
90 // in the same order that they are sent.
91 void OnIncomingMessageInOrder(std::unique_ptr<JingleMessage> message,
Sergey Ulanov 2016/10/19 21:23:39 Call this ProcessIncomingMessage()?
kelvinp 2016/10/21 00:26:03 Done.
92 const ReplyCallback& reply_callback);
93
87 // Message handlers for incoming messages. 94 // Message handlers for incoming messages.
88 void OnAccept(std::unique_ptr<JingleMessage> message, 95 void OnAccept(std::unique_ptr<JingleMessage> message,
89 const ReplyCallback& reply_callback); 96 const ReplyCallback& reply_callback);
90 void OnSessionInfo(std::unique_ptr<JingleMessage> message, 97 void OnSessionInfo(std::unique_ptr<JingleMessage> message,
91 const ReplyCallback& reply_callback); 98 const ReplyCallback& reply_callback);
92 void OnTerminate(std::unique_ptr<JingleMessage> message, 99 void OnTerminate(std::unique_ptr<JingleMessage> message,
93 const ReplyCallback& reply_callback); 100 const ReplyCallback& reply_callback);
94 101
95 // Called from OnAccept() to initialize session config. 102 // Called from OnAccept() to initialize session config.
96 bool InitializeConfigFromDescription(const ContentDescription* description); 103 bool InitializeConfigFromDescription(const ContentDescription* description);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 std::unique_ptr<Authenticator> authenticator_; 135 std::unique_ptr<Authenticator> authenticator_;
129 136
130 Transport* transport_ = nullptr; 137 Transport* transport_ = nullptr;
131 138
132 // Pending Iq requests. Used for all messages except transport-info. 139 // Pending Iq requests. Used for all messages except transport-info.
133 std::set<std::unique_ptr<IqRequest>> pending_requests_; 140 std::set<std::unique_ptr<IqRequest>> pending_requests_;
134 141
135 // Pending transport-info requests. 142 // Pending transport-info requests.
136 std::list<std::unique_ptr<IqRequest>> transport_info_requests_; 143 std::list<std::unique_ptr<IqRequest>> transport_info_requests_;
137 144
145 struct PendingMessage {
146 PendingMessage(std::unique_ptr<JingleMessage> message,
147 const ReplyCallback& reply_callback);
148 ~PendingMessage();
149 std::unique_ptr<JingleMessage> message;
150 const ReplyCallback reply_callback;
151 };
152
153 // A message queue to guarantee the incoming messages are processed in order.
154 class OrderedMessageQueue;
155 std::unique_ptr<OrderedMessageQueue> message_queue_;
156
138 base::WeakPtrFactory<JingleSession> weak_factory_; 157 base::WeakPtrFactory<JingleSession> weak_factory_;
139 158
140 DISALLOW_COPY_AND_ASSIGN(JingleSession); 159 DISALLOW_COPY_AND_ASSIGN(JingleSession);
141 }; 160 };
142 161
143 } // namespace protocol 162 } // namespace protocol
144 } // namespace remoting 163 } // namespace remoting
145 164
146 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_ 165 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/protocol/jingle_session.cc » ('j') | remoting/protocol/jingle_session.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698