summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 00:55:22 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 00:55:22 +0000
commit3f87dad482089e8df379db64d9647d5674d90175 (patch)
treec1e289d0e033fc53065469d8bedd6e596a63df68 /remoting
parent7a48a13bc6fc3464c5dca7e088290462b5110248 (diff)
downloadchromium_src-3f87dad482089e8df379db64d9647d5674d90175.zip
chromium_src-3f87dad482089e8df379db64d9647d5674d90175.tar.gz
chromium_src-3f87dad482089e8df379db64d9647d5674d90175.tar.bz2
Create UserInterface object on the UI thread.
Now UserInterface objects weak pointer to itself that is created in the constructor. That weak pointer is used on the UI thread, so it needs to be created on UI thread too. Review URL: https://chromiumcodereview.appspot.com/10543068 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141136 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/host_user_interface.cc4
-rw-r--r--remoting/host/plugin/host_script_object.cc6
2 files changed, 6 insertions, 4 deletions
diff --git a/remoting/host/host_user_interface.cc b/remoting/host/host_user_interface.cc
index 964473b..399a9fc 100644
--- a/remoting/host/host_user_interface.cc
+++ b/remoting/host/host_user_interface.cc
@@ -18,6 +18,7 @@ HostUserInterface::HostUserInterface(ChromotingHostContext* context)
is_monitoring_local_inputs_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
weak_ptr_(weak_factory_.GetWeakPtr()) {
+ DCHECK(ui_message_loop()->BelongsToCurrentThread());
}
HostUserInterface::~HostUserInterface() {
@@ -145,8 +146,7 @@ void HostUserInterface::ShowDisconnectWindow(bool show,
if (show) {
disconnect_window_->Show(
host_,
- base::Bind(&HostUserInterface::OnDisconnectCallback,
- weak_ptr_),
+ base::Bind(&HostUserInterface::OnDisconnectCallback, weak_ptr_),
username);
} else {
disconnect_window_->Hide();
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc
index fd3fa55..9158752 100644
--- a/remoting/host/plugin/host_script_object.cc
+++ b/remoting/host/plugin/host_script_object.cc
@@ -456,6 +456,10 @@ bool HostNPScriptObject::Connect(const NPVariant* args,
return false;
}
+ // The UserInterface object needs to be created on the UI thread.
+ it2me_host_user_interface_.reset(
+ new It2MeHostUserInterface(host_context_.get()));
+
ReadPolicyAndConnect(uid, auth_token, auth_service);
return true;
@@ -562,8 +566,6 @@ void HostNPScriptObject::FinishConnectNetworkThread(
base::Closure disconnect_callback = base::Bind(
&ChromotingHost::Shutdown, base::Unretained(host_.get()),
base::Closure());
- it2me_host_user_interface_.reset(
- new It2MeHostUserInterface(host_context_.get()));
it2me_host_user_interface_->Start(host_.get(), disconnect_callback);
{