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

Side by Side Diff: remoting/client/chromoting_client.cc

Issue 7575016: Don't use JingleThread in the client plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update DEPS Created 9 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 | Annotate | Revision Log
« no previous file with comments | « remoting/client/DEPS ('k') | remoting/client/client_context.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/client/chromoting_client.h" 5 #include "remoting/client/chromoting_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "jingle/glue/thread_wrapper.h"
9 #include "remoting/base/tracer.h" 10 #include "remoting/base/tracer.h"
10 #include "remoting/client/chromoting_view.h" 11 #include "remoting/client/chromoting_view.h"
11 #include "remoting/client/client_context.h" 12 #include "remoting/client/client_context.h"
12 #include "remoting/client/input_handler.h" 13 #include "remoting/client/input_handler.h"
13 #include "remoting/client/rectangle_update_decoder.h" 14 #include "remoting/client/rectangle_update_decoder.h"
14 #include "remoting/protocol/connection_to_host.h" 15 #include "remoting/protocol/connection_to_host.h"
15 #include "remoting/protocol/session_config.h" 16 #include "remoting/protocol/session_config.h"
16 17
17 namespace remoting { 18 namespace remoting {
18 19
(...skipping 20 matching lines...) Expand all
39 } 40 }
40 41
41 void ChromotingClient::Start(scoped_refptr<XmppProxy> xmpp_proxy) { 42 void ChromotingClient::Start(scoped_refptr<XmppProxy> xmpp_proxy) {
42 if (message_loop() != MessageLoop::current()) { 43 if (message_loop() != MessageLoop::current()) {
43 message_loop()->PostTask( 44 message_loop()->PostTask(
44 FROM_HERE, 45 FROM_HERE,
45 NewRunnableMethod(this, &ChromotingClient::Start, xmpp_proxy)); 46 NewRunnableMethod(this, &ChromotingClient::Start, xmpp_proxy));
46 return; 47 return;
47 } 48 }
48 49
50 jingle_glue::JingleThreadWrapper::EnsureForCurrentThread();
51
49 connection_->Connect(xmpp_proxy, config_.local_jid, config_.host_jid, 52 connection_->Connect(xmpp_proxy, config_.local_jid, config_.host_jid,
50 config_.host_public_key, config_.access_code, 53 config_.host_public_key, config_.access_code,
51 this, this, this); 54 this, this, this);
52 55
53 if (!view_->Initialize()) { 56 if (!view_->Initialize()) {
54 ClientDone(); 57 ClientDone();
55 } 58 }
56 } 59 }
57 60
58 void ChromotingClient::Stop(const base::Closure& shutdown_task) { 61 void ChromotingClient::Stop(const base::Closure& shutdown_task) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 VLOG(1) << "ChromotingClient::OnConnectionClosed"; 176 VLOG(1) << "ChromotingClient::OnConnectionClosed";
174 SetConnectionState(DISCONNECTED); 177 SetConnectionState(DISCONNECTED);
175 } 178 }
176 179
177 void ChromotingClient::OnConnectionFailed(protocol::ConnectionToHost* conn) { 180 void ChromotingClient::OnConnectionFailed(protocol::ConnectionToHost* conn) {
178 VLOG(1) << "ChromotingClient::OnConnectionFailed"; 181 VLOG(1) << "ChromotingClient::OnConnectionFailed";
179 SetConnectionState(FAILED); 182 SetConnectionState(FAILED);
180 } 183 }
181 184
182 MessageLoop* ChromotingClient::message_loop() { 185 MessageLoop* ChromotingClient::message_loop() {
183 return context_->jingle_thread()->message_loop(); 186 return context_->network_message_loop();
184 } 187 }
185 188
186 void ChromotingClient::SetConnectionState(ConnectionState s) { 189 void ChromotingClient::SetConnectionState(ConnectionState s) {
187 // TODO(ajwong): We actually may want state to be a shared variable. Think 190 // TODO(ajwong): We actually may want state to be a shared variable. Think
188 // through later. 191 // through later.
189 if (message_loop() != MessageLoop::current()) { 192 if (message_loop() != MessageLoop::current()) {
190 message_loop()->PostTask( 193 message_loop()->PostTask(
191 FROM_HERE, 194 FROM_HERE,
192 NewRunnableMethod(this, &ChromotingClient::SetConnectionState, s)); 195 NewRunnableMethod(this, &ChromotingClient::SetConnectionState, s));
193 return; 196 return;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 if (msg->success()) { 269 if (msg->success()) {
267 connection_->OnClientAuthenticated(); 270 connection_->OnClientAuthenticated();
268 } 271 }
269 272
270 view_->UpdateLoginStatus(msg->success(), msg->error_info()); 273 view_->UpdateLoginStatus(msg->success(), msg->error_info());
271 done->Run(); 274 done->Run();
272 delete done; 275 delete done;
273 } 276 }
274 277
275 } // namespace remoting 278 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/DEPS ('k') | remoting/client/client_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698