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

Side by Side Diff: remoting/jingle_glue/jingle_client.cc

Issue 3084024: Start chromoting host in the service process though a method call (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // TODO(ajwong): We assign and read from a few of the member variables on 5 // TODO(ajwong): We assign and read from a few of the member variables on
6 // two threads. We need to audit this for thread safety. 6 // two threads. We need to audit this for thread safety.
7 7
8 #include "remoting/jingle_glue/jingle_client.h" 8 #include "remoting/jingle_glue/jingle_client.h"
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 DCHECK_EQ(message_loop(), MessageLoop::current()); 69 DCHECK_EQ(message_loop(), MessageLoop::current());
70 70
71 talk_base::StreamInterface* stream = 71 talk_base::StreamInterface* stream =
72 tunnel_session_client_->CreateTunnel(buzz::Jid(host_jid), ""); 72 tunnel_session_client_->CreateTunnel(buzz::Jid(host_jid), "");
73 DCHECK(stream != NULL); 73 DCHECK(stream != NULL);
74 74
75 channel->Init(thread_, stream, host_jid); 75 channel->Init(thread_, stream, host_jid);
76 } 76 }
77 77
78 void JingleClient::Close() { 78 void JingleClient::Close() {
79 // Once we are closed we really shouldn't talk to the callback again. In the
80 // case when JingleClient outlives the owner access the callback is not safe.
81 // TODO(hclam): We need to lock to reset callback.
82 callback_ = NULL;
83
79 message_loop()->PostTask( 84 message_loop()->PostTask(
80 FROM_HERE, NewRunnableMethod(this, &JingleClient::DoClose)); 85 FROM_HERE, NewRunnableMethod(this, &JingleClient::DoClose));
81 } 86 }
82 87
83 void JingleClient::DoClose() { 88 void JingleClient::DoClose() {
84 DCHECK_EQ(message_loop(), MessageLoop::current()); 89 DCHECK_EQ(message_loop(), MessageLoop::current());
85 90
86 // If we have not yet initialized and the client is already closed then 91 // If we have not yet initialized and the client is already closed then
87 // don't close again. 92 // don't close again.
88 if (!callback_ || state_ == CLOSED) 93 if (state_ == CLOSED)
89 return; 94 return;
90 95
91 client_->Disconnect(); 96 if (client_) {
92 // Client is deleted by TaskRunner. 97 client_->Disconnect();
93 client_ = NULL; 98 // Client is deleted by TaskRunner.
99 client_ = NULL;
100 }
94 tunnel_session_client_.reset(); 101 tunnel_session_client_.reset();
95 port_allocator_.reset(); 102 port_allocator_.reset();
96 session_manager_.reset(); 103 session_manager_.reset();
97 network_manager_.reset(); 104 network_manager_.reset();
98 UpdateState(CLOSED); 105 UpdateState(CLOSED);
99 } 106 }
100 107
101 void JingleClient::DoInitialize(const std::string& username, 108 void JingleClient::DoInitialize(const std::string& username,
102 const std::string& auth_token, 109 const std::string& auth_token,
103 const std::string& auth_token_service) { 110 const std::string& auth_token_service) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 227 }
221 228
222 buzz::PreXmppAuth* JingleClient::CreatePreXmppAuth( 229 buzz::PreXmppAuth* JingleClient::CreatePreXmppAuth(
223 const buzz::XmppClientSettings& settings) { 230 const buzz::XmppClientSettings& settings) {
224 buzz::Jid jid(settings.user(), settings.host(), buzz::STR_EMPTY); 231 buzz::Jid jid(settings.user(), settings.host(), buzz::STR_EMPTY);
225 return new GaiaTokenPreXmppAuth(jid.Str(), settings.auth_cookie(), 232 return new GaiaTokenPreXmppAuth(jid.Str(), settings.auth_cookie(),
226 settings.token_service()); 233 settings.token_service());
227 } 234 }
228 235
229 } // namespace remoting 236 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698