summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-10 18:45:40 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-10 18:45:40 +0000
commit2b610dd17148a71cad5da51b3eabf31d2cdc80c7 (patch)
tree348566efe4aa3220c4197df3b38d0ddce3d4e1a4 /remoting
parentba70635dfed6674b8a87d581bb3241d1765cdafe (diff)
downloadchromium_src-2b610dd17148a71cad5da51b3eabf31d2cdc80c7.zip
chromium_src-2b610dd17148a71cad5da51b3eabf31d2cdc80c7.tar.gz
chromium_src-2b610dd17148a71cad5da51b3eabf31d2cdc80c7.tar.bz2
Resubmit "Start chromoting host in the service process though a method call"
This change exposes method calls to configure the chromoting host and allow it to be started from a method. This will allow us to use IPC message to start the chromoting host. TEST=unit_tests --gtest_filter=ServiceProcess* BUG=50243, 50244 Review URL: http://codereview.chromium.org/3105002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55593 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/heartbeat_sender.cc6
-rw-r--r--remoting/jingle_glue/jingle_client.cc15
-rw-r--r--remoting/remoting.gyp4
3 files changed, 17 insertions, 8 deletions
diff --git a/remoting/host/heartbeat_sender.cc b/remoting/host/heartbeat_sender.cc
index b62b268a..e6a78f7 100644
--- a/remoting/host/heartbeat_sender.cc
+++ b/remoting/host/heartbeat_sender.cc
@@ -65,7 +65,7 @@ void HeartbeatSender::Start() {
return;
}
- DCHECK(state_ == INITIALIZED);
+ DCHECK_EQ(INITIALIZED, state_);
state_ = STARTED;
request_.reset(jingle_client_->CreateIqRequest());
@@ -82,7 +82,9 @@ void HeartbeatSender::Stop() {
return;
}
- DCHECK(state_ == STARTED);
+ // We may call Stop() even if we have not started.
+ if (state_ != STARTED)
+ return;
state_ = STOPPED;
request_.reset(NULL);
}
diff --git a/remoting/jingle_glue/jingle_client.cc b/remoting/jingle_glue/jingle_client.cc
index eb89e21..b3ea334 100644
--- a/remoting/jingle_glue/jingle_client.cc
+++ b/remoting/jingle_glue/jingle_client.cc
@@ -76,6 +76,11 @@ void JingleClient::DoConnect(scoped_refptr<JingleChannel> channel,
}
void JingleClient::Close() {
+ // Once we are closed we really shouldn't talk to the callback again. In the
+ // case when JingleClient outlives the owner access the callback is not safe.
+ // TODO(hclam): We need to lock to reset callback.
+ callback_ = NULL;
+
message_loop()->PostTask(
FROM_HERE, NewRunnableMethod(this, &JingleClient::DoClose));
}
@@ -85,12 +90,14 @@ void JingleClient::DoClose() {
// If we have not yet initialized and the client is already closed then
// don't close again.
- if (!callback_ || state_ == CLOSED)
+ if (state_ == CLOSED)
return;
- client_->Disconnect();
- // Client is deleted by TaskRunner.
- client_ = NULL;
+ if (client_) {
+ client_->Disconnect();
+ // Client is deleted by TaskRunner.
+ client_ = NULL;
+ }
tunnel_session_client_.reset();
port_allocator_.reset();
session_manager_.reset();
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index 51afbbf..b1c6e1a 100644
--- a/remoting/remoting.gyp
+++ b/remoting/remoting.gyp
@@ -172,6 +172,8 @@
'sources': [
'host/capturer.cc',
'host/capturer.h',
+ 'host/capturer_fake.cc',
+ 'host/capturer_fake.h',
'host/chromoting_host.cc',
'host/chromoting_host.h',
'host/chromoting_host_context.cc',
@@ -261,8 +263,6 @@
'../base/base.gyp:base_i18n',
],
'sources': [
- 'host/capturer_fake.cc',
- 'host/capturer_fake.h',
'host/capturer_fake_ascii.cc',
'host/capturer_fake_ascii.h',
'host/simple_host_process.cc',