summaryrefslogtreecommitdiffstats
path: root/remoting/client/chromoting_client.h
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-07 17:40:08 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-07 17:40:08 +0000
commitdd71eeb64f572b16552ed730676455fef635283e (patch)
treea7216339a5963260abc1a2d0cb5c6a4d35682b71 /remoting/client/chromoting_client.h
parent01bf789e284b82c1163b1378e9ec73bedd19bad7 (diff)
downloadchromium_src-dd71eeb64f572b16552ed730676455fef635283e.zip
chromium_src-dd71eeb64f572b16552ed730676455fef635283e.tar.gz
chromium_src-dd71eeb64f572b16552ed730676455fef635283e.tar.bz2
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. This is a re-land of CL 1045404, replacing some CR_DEFINE_STATIC_LOCAL() instances with base::LazyInstance to avoid adding global initializers or finalizers. TEST=Existing unit-tests, and manual testing. Review URL: https://chromiumcodereview.appspot.com/10440107 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141028 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client/chromoting_client.h')
-rw-r--r--remoting/client/chromoting_client.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/remoting/client/chromoting_client.h b/remoting/client/chromoting_client.h
index bbb8a48..6856a20 100644
--- a/remoting/client/chromoting_client.h
+++ b/remoting/client/chromoting_client.h
@@ -10,8 +10,8 @@
#include <list>
#include "base/callback.h"
+#include "base/memory/weak_ptr.h"
#include "base/time.h"
-#include "remoting/base/scoped_thread_proxy.h"
#include "remoting/client/client_config.h"
#include "remoting/client/chromoting_stats.h"
#include "remoting/client/chromoting_view.h"
@@ -124,7 +124,9 @@ class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback,
// Keep track of the last sequence number bounced back from the host.
int64 last_sequence_number_;
- ScopedThreadProxy thread_proxy_;
+ // WeakPtr used to avoid tasks accessing the client after it is deleted.
+ base::WeakPtrFactory<ChromotingClient> weak_factory_;
+ base::WeakPtr<ChromotingClient> weak_ptr_;
DISALLOW_COPY_AND_ASSIGN(ChromotingClient);
};