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

Side by Side Diff: remoting/client/plugin/chromoting_instance.cc

Issue 10454018: MessageLoopProxy cleanups in remoting client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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) 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 #include "remoting/client/plugin/chromoting_instance.h" 5 #include "remoting/client/plugin/chromoting_instance.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 // Start all the threads. 200 // Start all the threads.
201 context_.Start(); 201 context_.Start();
202 202
203 // Create the chromoting objects that don't depend on the network connection. 203 // Create the chromoting objects that don't depend on the network connection.
204 // RectangleUpdateDecoder runs on a separate thread so for now we wrap 204 // RectangleUpdateDecoder runs on a separate thread so for now we wrap
205 // PepperView with a ref-counted proxy object. 205 // PepperView with a ref-counted proxy object.
206 scoped_refptr<FrameConsumerProxy> consumer_proxy = 206 scoped_refptr<FrameConsumerProxy> consumer_proxy =
207 new FrameConsumerProxy(plugin_message_loop_); 207 new FrameConsumerProxy(plugin_message_loop_);
208 rectangle_decoder_ = new RectangleUpdateDecoder( 208 rectangle_decoder_ = new RectangleUpdateDecoder(
209 context_.decode_message_loop(), consumer_proxy); 209 context_.decode_task_runner(), consumer_proxy);
210 view_.reset(new PepperView(this, &context_, rectangle_decoder_.get())); 210 view_.reset(new PepperView(this, &context_, rectangle_decoder_.get()));
211 consumer_proxy->Attach(view_->AsWeakPtr()); 211 consumer_proxy->Attach(view_->AsWeakPtr());
212 212
213 return true; 213 return true;
214 } 214 }
215 215
216 void ChromotingInstance::HandleMessage(const pp::Var& message) { 216 void ChromotingInstance::HandleMessage(const pp::Var& message) {
217 if (!message.is_string()) { 217 if (!message.is_string()) {
218 LOG(ERROR) << "Received a message that is not a string."; 218 LOG(ERROR) << "Received a message that is not a string.";
219 return; 219 return;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 return NULL; 396 return NULL;
397 } 397 }
398 398
399 void ChromotingInstance::Connect(const ClientConfig& config) { 399 void ChromotingInstance::Connect(const ClientConfig& config) {
400 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); 400 DCHECK(plugin_message_loop_->BelongsToCurrentThread());
401 401
402 jingle_glue::JingleThreadWrapper::EnsureForCurrentThread(); 402 jingle_glue::JingleThreadWrapper::EnsureForCurrentThread();
403 403
404 host_connection_.reset(new protocol::ConnectionToHost(true)); 404 host_connection_.reset(new protocol::ConnectionToHost(true));
405 client_.reset(new ChromotingClient(config, &context_, host_connection_.get(), 405 client_.reset(new ChromotingClient(config, &context_, host_connection_.get(),
406 view_.get(), rectangle_decoder_.get(), 406 view_.get(), rectangle_decoder_.get()));
407 base::Closure()));
408 407
409 // Construct the input pipeline 408 // Construct the input pipeline
410 mouse_input_filter_.reset( 409 mouse_input_filter_.reset(
411 new protocol::MouseInputFilter(host_connection_->input_stub())); 410 new protocol::MouseInputFilter(host_connection_->input_stub()));
412 mouse_input_filter_->set_input_size(view_->get_view_size()); 411 mouse_input_filter_->set_input_size(view_->get_view_size());
413 input_tracker_.reset( 412 input_tracker_.reset(
414 new protocol::InputEventTracker(mouse_input_filter_.get())); 413 new protocol::InputEventTracker(mouse_input_filter_.get()));
415 414
416 #if defined(OS_MACOSX) 415 #if defined(OS_MACOSX)
417 // On Mac we need an extra filter to inject missing keyup events. 416 // On Mac we need an extra filter to inject missing keyup events.
418 // See remoting/client/plugin/mac_key_event_processor.h for more details. 417 // See remoting/client/plugin/mac_key_event_processor.h for more details.
419 mac_key_event_processor_.reset( 418 mac_key_event_processor_.reset(
420 new MacKeyEventProcessor(input_tracker_.get())); 419 new MacKeyEventProcessor(input_tracker_.get()));
421 key_mapper_.set_input_stub(mac_key_event_processor_.get()); 420 key_mapper_.set_input_stub(mac_key_event_processor_.get());
422 #else 421 #else
423 key_mapper_.set_input_stub(input_tracker_.get()); 422 key_mapper_.set_input_stub(input_tracker_.get());
424 #endif 423 #endif
425 input_handler_.reset( 424 input_handler_.reset(
426 new PepperInputHandler(&key_mapper_)); 425 new PepperInputHandler(&key_mapper_));
427 426
428 LOG(INFO) << "Connecting to " << config.host_jid 427 LOG(INFO) << "Connecting to " << config.host_jid
429 << ". Local jid: " << config.local_jid << "."; 428 << ". Local jid: " << config.local_jid << ".";
430 429
431 // Setup the XMPP Proxy. 430 // Setup the XMPP Proxy.
432 xmpp_proxy_ = new PepperXmppProxy( 431 xmpp_proxy_ = new PepperXmppProxy(
433 base::Bind(&ChromotingInstance::SendOutgoingIq, AsWeakPtr()), 432 base::Bind(&ChromotingInstance::SendOutgoingIq, AsWeakPtr()),
434 plugin_message_loop_, 433 plugin_message_loop_, context_.main_task_runner());
435 context_.network_message_loop());
436 434
437 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator( 435 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator(
438 PepperPortAllocator::Create(this)); 436 PepperPortAllocator::Create(this));
439 scoped_ptr<protocol::TransportFactory> transport_factory( 437 scoped_ptr<protocol::TransportFactory> transport_factory(
440 new protocol::LibjingleTransportFactory(port_allocator.Pass(), false)); 438 new protocol::LibjingleTransportFactory(port_allocator.Pass(), false));
441 439
442 // Kick off the connection. 440 // Kick off the connection.
443 client_->Start(xmpp_proxy_, transport_factory.Pass()); 441 client_->Start(xmpp_proxy_, transport_factory.Pass());
444 442
445 // Start timer that periodically sends perf stats. 443 // Start timer that periodically sends perf stats.
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 } 685 }
688 g_logging_to_plugin = false; 686 g_logging_to_plugin = false;
689 } 687 }
690 688
691 bool ChromotingInstance::IsConnected() { 689 bool ChromotingInstance::IsConnected() {
692 return host_connection_.get() && 690 return host_connection_.get() &&
693 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); 691 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED);
694 } 692 }
695 693
696 } // namespace remoting 694 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698