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

Unified Diff: remoting/protocol/pepper_session.cc

Issue 8116021: Switch remoting/protocol to new callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/pepper_session.h ('k') | remoting/protocol/pepper_session_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/pepper_session.cc
diff --git a/remoting/protocol/pepper_session.cc b/remoting/protocol/pepper_session.cc
index 509440e779827986c6617d60190c83e296383b71..5e971bd2e4beb4722fbffb4a310032f49cb53940 100644
--- a/remoting/protocol/pepper_session.cc
+++ b/remoting/protocol/pepper_session.cc
@@ -44,9 +44,10 @@ PepperSession::~PepperSession() {
session_manager_->SessionDestroyed(this);
}
-void PepperSession::SetStateChangeCallback(StateChangeCallback* callback) {
+void PepperSession::SetStateChangeCallback(
+ const StateChangeCallback& callback) {
DCHECK(CalledOnValidThread());
- state_change_callback_.reset(callback);
+ state_change_callback_ = callback;
}
Session::Error PepperSession::error() {
@@ -59,14 +60,14 @@ void PepperSession::StartConnection(
const std::string& peer_public_key,
const std::string& client_token,
CandidateSessionConfig* config,
- Session::StateChangeCallback* state_change_callback) {
+ const StateChangeCallback& state_change_callback) {
DCHECK(CalledOnValidThread());
peer_jid_ = peer_jid;
peer_public_key_ = peer_public_key;
initiator_token_ = client_token;
candidate_config_.reset(config);
- state_change_callback_.reset(state_change_callback);
+ state_change_callback_ = state_change_callback;
// Generate random session ID. There are usually not more than 1
// concurrent session per host, so a random 64-bit integer provides
@@ -382,8 +383,8 @@ void PepperSession::SetState(State new_state) {
DCHECK_NE(state_, FAILED);
state_ = new_state;
- if (state_change_callback_.get())
- state_change_callback_->Run(new_state);
+ if (!state_change_callback_.is_null())
+ state_change_callback_.Run(new_state);
}
}
« no previous file with comments | « remoting/protocol/pepper_session.h ('k') | remoting/protocol/pepper_session_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698