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

Side by Side Diff: remoting/protocol/pepper_session.cc

Issue 9005034: Refactor SignalStrategy so that it can be reused for multiple connections. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "remoting/protocol/pepper_session.h" 5 #include "remoting/protocol/pepper_session.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 // Generate random session ID. There are usually not more than 1 71 // Generate random session ID. There are usually not more than 1
72 // concurrent session per host, so a random 64-bit integer provides 72 // concurrent session per host, so a random 64-bit integer provides
73 // enough entropy. In the worst case connection will fail when two 73 // enough entropy. In the worst case connection will fail when two
74 // clients generate the same session ID concurrently. 74 // clients generate the same session ID concurrently.
75 session_id_ = base::Int64ToString(base::RandGenerator(kint64max)); 75 session_id_ = base::Int64ToString(base::RandGenerator(kint64max));
76 76
77 // Send session-initiate message. 77 // Send session-initiate message.
78 JingleMessage message(peer_jid_, JingleMessage::SESSION_INITIATE, 78 JingleMessage message(peer_jid_, JingleMessage::SESSION_INITIATE,
79 session_id_); 79 session_id_);
80 message.from = session_manager_->local_jid_; 80 message.from = session_manager_->signal_strategy_->GetLocalJid();
81 message.description.reset( 81 message.description.reset(
82 new ContentDescription(candidate_config_->Clone(), 82 new ContentDescription(candidate_config_->Clone(),
83 authenticator_->GetNextMessage())); 83 authenticator_->GetNextMessage()));
84 initiate_request_.reset(session_manager_->iq_sender()->SendIq( 84 initiate_request_.reset(session_manager_->iq_sender()->SendIq(
85 message.ToXml(), 85 message.ToXml(),
86 base::Bind(&PepperSession::OnSessionInitiateResponse, 86 base::Bind(&PepperSession::OnSessionInitiateResponse,
87 base::Unretained(this)))); 87 base::Unretained(this))));
88 88
89 SetState(CONNECTING); 89 SetState(CONNECTING);
90 } 90 }
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 DCHECK_NE(state_, FAILED); 424 DCHECK_NE(state_, FAILED);
425 425
426 state_ = new_state; 426 state_ = new_state;
427 if (!state_change_callback_.is_null()) 427 if (!state_change_callback_.is_null())
428 state_change_callback_.Run(new_state); 428 state_change_callback_.Run(new_state);
429 } 429 }
430 } 430 }
431 431
432 } // namespace protocol 432 } // namespace protocol
433 } // namespace remoting 433 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/jingle_session_unittest.cc ('k') | remoting/protocol/pepper_session_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698