summaryrefslogtreecommitdiffstats
path: root/remoting/client/chromoting_client.cc
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-30 21:09:33 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-30 21:09:33 +0000
commitb6791a77ae5c2eec843b8c9b4ad3d9fa9c11fda7 (patch)
tree608a649c16b2af968a0d250ba1c30b118e6bb3ba /remoting/client/chromoting_client.cc
parent910875d9a35955b0e51d150c40879eb892250155 (diff)
downloadchromium_src-b6791a77ae5c2eec843b8c9b4ad3d9fa9c11fda7.zip
chromium_src-b6791a77ae5c2eec843b8c9b4ad3d9fa9c11fda7.tar.gz
chromium_src-b6791a77ae5c2eec843b8c9b4ad3d9fa9c11fda7.tar.bz2
Revert 139623 - Replace ScopedThreadProxy with MessageLoopProxy & WeakPtrs.
This affects the following classes: * ChromotingClient * ChromotingInstance * HostUserInterface * It2MeHostUserInterface The MessageLoopProxy/WeakPtr combination requires that the WeakPtr is created on the thread referred to by the proxy; code in which that is hard to arrange usually has subtle race-conditions. TEST=Existing unit-tests, and manual testing. Review URL: https://chromiumcodereview.appspot.com/10454040 TBR=wez@chromium.org Review URL: https://chromiumcodereview.appspot.com/10446088 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139633 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client/chromoting_client.cc')
-rw-r--r--remoting/client/chromoting_client.cc15
1 files changed, 6 insertions, 9 deletions
diff --git a/remoting/client/chromoting_client.cc b/remoting/client/chromoting_client.cc
index 2a3aa56..4dabdd2 100644
--- a/remoting/client/chromoting_client.cc
+++ b/remoting/client/chromoting_client.cc
@@ -41,7 +41,7 @@ ChromotingClient::ChromotingClient(const ClientConfig& config,
client_done_(client_done),
packet_being_processed_(false),
last_sequence_number_(0),
- weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
+ thread_proxy_(context_->network_message_loop()) {
}
ChromotingClient::~ChromotingClient() {
@@ -52,9 +52,6 @@ void ChromotingClient::Start(
scoped_ptr<protocol::TransportFactory> transport_factory) {
DCHECK(message_loop()->BelongsToCurrentThread());
- // Create a WeakPtr to ourself for to use for all posted tasks.
- weak_ptr_ = weak_factory_.GetWeakPtr();
-
scoped_ptr<protocol::Authenticator> authenticator;
if (config_.use_v1_authenticator) {
authenticator.reset(new protocol::V1ClientAuthenticator(
@@ -78,7 +75,7 @@ void ChromotingClient::Stop(const base::Closure& shutdown_task) {
if (!message_loop()->BelongsToCurrentThread()) {
message_loop()->PostTask(
FROM_HERE, base::Bind(&ChromotingClient::Stop,
- weak_ptr_, shutdown_task));
+ base::Unretained(this), shutdown_task));
return;
}
@@ -90,7 +87,7 @@ void ChromotingClient::Stop(const base::Closure& shutdown_task) {
}
connection_->Disconnect(base::Bind(&ChromotingClient::OnDisconnected,
- weak_ptr_, shutdown_task));
+ base::Unretained(this), shutdown_task));
}
void ChromotingClient::OnDisconnected(const base::Closure& shutdown_task) {
@@ -195,7 +192,7 @@ base::MessageLoopProxy* ChromotingClient::message_loop() {
void ChromotingClient::OnPacketDone(bool last_packet,
base::Time decode_start) {
if (!message_loop()->BelongsToCurrentThread()) {
- message_loop()->PostTask(FROM_HERE, base::Bind(
+ thread_proxy_.PostTask(FROM_HERE, base::Bind(
&ChromotingClient::OnPacketDone, base::Unretained(this),
last_packet, decode_start));
return;
@@ -219,8 +216,8 @@ void ChromotingClient::OnPacketDone(bool last_packet,
void ChromotingClient::Initialize() {
if (!message_loop()->BelongsToCurrentThread()) {
- message_loop()->PostTask(FROM_HERE, base::Bind(
- &ChromotingClient::Initialize, weak_ptr_));
+ thread_proxy_.PostTask(FROM_HERE, base::Bind(
+ &ChromotingClient::Initialize, base::Unretained(this)));
return;
}