Commit f9d8a772 authored by rsleevi@chromium.org's avatar rsleevi@chromium.org

Update remoting/ and jingle/ to use scoped_refptr<T>::get() rather than implicit "operator T*"

Linux fixes

BUG=110610
TBR=darin

Review URL: https://chromiumcodereview.appspot.com/15782010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203573 0039d316-1c4b-4281-b951-d872f2087c98
parent 83501baf
......@@ -143,7 +143,7 @@ void TransportChannelSocketAdapter::OnNewPacket(
DCHECK_EQ(base::MessageLoop::current(), message_loop_);
DCHECK_EQ(channel, channel_);
if (!read_callback_.is_null()) {
DCHECK(read_buffer_);
DCHECK(read_buffer_.get());
CHECK_LT(data_size, static_cast<size_t>(std::numeric_limits<int>::max()));
if (read_buffer_size_ < static_cast<int>(data_size)) {
......
......@@ -68,7 +68,7 @@ class TransportChannelSocketAdapterTest : public testing::Test {
TEST_F(TransportChannelSocketAdapterTest, Read) {
scoped_refptr<IOBuffer> buffer(new IOBuffer(kBufferSize));
int result = target_->Read(buffer, kBufferSize, callback_);
int result = target_->Read(buffer.get(), kBufferSize, callback_);
ASSERT_EQ(net::ERR_IO_PENDING, result);
channel_.SignalReadPacket(&channel_, kTestData, kTestDataSize, 0);
......@@ -79,14 +79,14 @@ TEST_F(TransportChannelSocketAdapterTest, Read) {
TEST_F(TransportChannelSocketAdapterTest, ReadClose) {
scoped_refptr<IOBuffer> buffer(new IOBuffer(kBufferSize));
int result = target_->Read(buffer, kBufferSize, callback_);
int result = target_->Read(buffer.get(), kBufferSize, callback_);
ASSERT_EQ(net::ERR_IO_PENDING, result);
target_->Close(kTestError);
EXPECT_EQ(kTestError, callback_result_);
// All Read() calls after Close() should return the error.
EXPECT_EQ(kTestError, target_->Read(buffer, kBufferSize, callback_));
EXPECT_EQ(kTestError, target_->Read(buffer.get(), kBufferSize, callback_));
}
// Verify that Write sends the packet and returns correct result.
......@@ -96,7 +96,7 @@ TEST_F(TransportChannelSocketAdapterTest, Write) {
EXPECT_CALL(channel_, SendPacket(buffer->data(), kTestDataSize, 0))
.WillOnce(Return(kTestDataSize));
int result = target_->Write(buffer, kTestDataSize, callback_);
int result = target_->Write(buffer.get(), kTestDataSize, callback_);
EXPECT_EQ(kTestDataSize, result);
}
......@@ -112,7 +112,7 @@ TEST_F(TransportChannelSocketAdapterTest, WritePending) {
EXPECT_CALL(channel_, GetError())
.WillOnce(Return(EWOULDBLOCK));
int result = target_->Write(buffer, kTestDataSize, callback_);
int result = target_->Write(buffer.get(), kTestDataSize, callback_);
ASSERT_EQ(net::OK, result);
}
......
......@@ -171,7 +171,7 @@ talk_base::AsyncPacketSocket* FakeSocketFactory::CreateUdpSocket(
CHECK_EQ(min_port, 0);
CHECK_EQ(max_port, 0);
return new FakeUDPPacketSocket(
socket_manager_, net::IPEndPoint(address_, ++last_allocated_port_));
socket_manager_.get(), net::IPEndPoint(address_, ++last_allocated_port_));
}
talk_base::AsyncPacketSocket* FakeSocketFactory::CreateServerTcpSocket(
......
......@@ -200,7 +200,8 @@ void FakeSSLClientSocket::ProcessConnectDone() {
int FakeSSLClientSocket::DoSendClientHello() {
int status = transport_socket_->Write(
write_buf_, write_buf_->BytesRemaining(),
write_buf_.get(),
write_buf_->BytesRemaining(),
base::Bind(&FakeSSLClientSocket::OnSendClientHelloDone,
base::Unretained(this)));
if (status < net::OK) {
......@@ -234,7 +235,8 @@ void FakeSSLClientSocket::ProcessSendClientHelloDone(size_t written) {
int FakeSSLClientSocket::DoVerifyServerHello() {
int status = transport_socket_->Read(
read_buf_, read_buf_->BytesRemaining(),
read_buf_.get(),
read_buf_->BytesRemaining(),
base::Bind(&FakeSSLClientSocket::OnVerifyServerHelloDone,
base::Unretained(this)));
if (status < net::OK) {
......
......@@ -164,14 +164,15 @@ class FakeSSLClientSocketTest : public testing::Test {
scoped_refptr<net::IOBuffer> read_buf(
new net::IOBuffer(read_buf_len));
int read_status = fake_ssl_client_socket.Read(
read_buf, read_buf_len, test_completion_callback.callback());
read_buf.get(), read_buf_len, test_completion_callback.callback());
ExpectStatus(mode, read_len, read_status, &test_completion_callback);
scoped_refptr<net::IOBuffer> write_buf(
new net::StringIOBuffer(kWriteTestData));
int write_status = fake_ssl_client_socket.Write(
write_buf, arraysize(kWriteTestData),
test_completion_callback.callback());
int write_status =
fake_ssl_client_socket.Write(write_buf.get(),
arraysize(kWriteTestData),
test_completion_callback.callback());
ExpectStatus(mode, arraysize(kWriteTestData), write_status,
&test_completion_callback);
} else {
......
......@@ -42,7 +42,7 @@ ProxyResolvingClientSocket::ProxyResolvingClientSocket(
request_context_getter->GetURLRequestContext()->net_log(),
net::NetLog::SOURCE_SOCKET)),
weak_factory_(this) {
DCHECK(request_context_getter);
DCHECK(request_context_getter.get());
net::URLRequestContext* request_context =
request_context_getter->GetURLRequestContext();
DCHECK(request_context);
......
......@@ -360,9 +360,10 @@ cricket::IPseudoTcpNotify::WriteResult PseudoTcpAdapter::Core::TcpWritePacket(
// send exactly as many bytes as we requested, or fail.
int result;
if (socket_.get()) {
result = socket_->Write(write_buffer, len,
base::Bind(&PseudoTcpAdapter::Core::OnWritten,
base::Unretained(this)));
result = socket_->Write(
write_buffer.get(),
len,
base::Bind(&PseudoTcpAdapter::Core::OnWritten, base::Unretained(this)));
} else {
result = net::ERR_CONNECTION_CLOSED;
}
......@@ -379,14 +380,15 @@ cricket::IPseudoTcpNotify::WriteResult PseudoTcpAdapter::Core::TcpWritePacket(
}
void PseudoTcpAdapter::Core::DoReadFromSocket() {
if (!socket_read_buffer_)
if (!socket_read_buffer_.get())
socket_read_buffer_ = new net::IOBuffer(kReadBufferSize);
int result = 1;
while (socket_.get() && result > 0) {
result = socket_->Read(socket_read_buffer_, kReadBufferSize,
base::Bind(&PseudoTcpAdapter::Core::OnRead,
base::Unretained(this)));
result = socket_->Read(
socket_read_buffer_.get(),
kReadBufferSize,
base::Bind(&PseudoTcpAdapter::Core::OnRead, base::Unretained(this)));
if (result != net::ERR_IO_PENDING)
HandleReadResults(result);
}
......
......@@ -231,7 +231,8 @@ class TCPChannelTester : public base::RefCountedThreadSafe<TCPChannelTester> {
int bytes_to_write = std::min(output_buffer_->BytesRemaining(),
kMessageSize);
result = client_socket_->Write(
output_buffer_, bytes_to_write,
output_buffer_.get(),
bytes_to_write,
base::Bind(&TCPChannelTester::OnWritten, base::Unretained(this)));
HandleWriteResult(result);
}
......@@ -257,9 +258,10 @@ class TCPChannelTester : public base::RefCountedThreadSafe<TCPChannelTester> {
while (result > 0) {
input_buffer_->set_offset(input_buffer_->capacity() - kMessageSize);
result = host_socket_->Read(input_buffer_, kMessageSize,
base::Bind(&TCPChannelTester::OnRead,
base::Unretained(this)));
result = host_socket_->Read(
input_buffer_.get(),
kMessageSize,
base::Bind(&TCPChannelTester::OnRead, base::Unretained(this)));
HandleReadResult(result);
};
}
......
......@@ -57,9 +57,9 @@ scoped_refptr<AutoThreadTaskRunner> AutoThread::CreateWithType(
const char* name,
scoped_refptr<AutoThreadTaskRunner> joiner,
base::MessageLoop::Type type) {
AutoThread* thread = new AutoThread(name, joiner);
AutoThread* thread = new AutoThread(name, joiner.get());
scoped_refptr<AutoThreadTaskRunner> task_runner = thread->StartWithType(type);
if (!task_runner)
if (!task_runner.get())
delete thread;
return task_runner;
}
......@@ -167,9 +167,10 @@ void AutoThread::QuitThread(
base::MessageLoop::current()->Quit();
was_quit_properly_ = true;
if (joiner_) {
joiner_->PostTask(FROM_HERE, base::Bind(&AutoThread::JoinAndDeleteThread,
base::Unretained(this)));
if (joiner_.get()) {
joiner_->PostTask(
FROM_HERE,
base::Bind(&AutoThread::JoinAndDeleteThread, base::Unretained(this)));
}
}
......
......@@ -52,7 +52,7 @@ void CompoundBuffer::Append(net::IOBuffer* buffer, int size) {
void CompoundBuffer::Append(const CompoundBuffer& buffer) {
for (DataChunkList::const_iterator it = buffer.chunks_.begin();
it != buffer.chunks_.end(); ++it) {
Append(it->buffer, it->start, it->size);
Append(it->buffer.get(), it->start, it->size);
}
}
......@@ -75,7 +75,7 @@ void CompoundBuffer::Prepend(net::IOBuffer* buffer, int size) {
void CompoundBuffer::Prepend(const CompoundBuffer& buffer) {
for (DataChunkList::const_iterator it = buffer.chunks_.begin();
it != buffer.chunks_.end(); ++it) {
Prepend(it->buffer, it->start, it->size);
Prepend(it->buffer.get(), it->start, it->size);
}
}
void CompoundBuffer::AppendCopyOf(const char* data, int size) {
......
......@@ -35,7 +35,7 @@ class CompoundBufferTest : public testing::Test {
// Following 5 methods are used with IterateOverPieces().
void Append(int pos, int size) {
target_.Append(data_, data_->data() + pos, size);
target_.Append(data_.get(), data_->data() + pos, size);
}
void AppendCopyOf(int pos, int size) {
......@@ -43,7 +43,7 @@ class CompoundBufferTest : public testing::Test {
}
void Prepend(int pos, int size) {
target_.Prepend(data_, data_->data() + kDataSize - pos - size, size);
target_.Prepend(data_.get(), data_->data() + kDataSize - pos - size, size);
}
void PrependCopyOf(int pos, int size) {
......
......@@ -97,7 +97,7 @@ std::string RsaKeyPair::GenerateCertificate() const {
key_.get(), "CN=chromoting",
base::RandInt(1, std::numeric_limits<int>::max()),
base::TimeDelta::FromDays(1));
if (!cert)
if (!cert.get())
return std::string();
std::string encoded;
......
......@@ -75,7 +75,7 @@ TEST_F(RsaKeyPairTest, Signatures) {
TEST_F(RsaKeyPairTest, GenerateKey) {
// Test that we can generate a valid key.
scoped_refptr<RsaKeyPair> key_pair = RsaKeyPair::Generate();
ASSERT_TRUE(key_pair);
ASSERT_TRUE(key_pair.get());
ASSERT_NE(key_pair->ToString(), "");
ASSERT_NE(key_pair->GetPublicKey(), "");
ASSERT_NE(key_pair->SignMessage(kTestMessage), "");
......
......@@ -40,8 +40,9 @@ void SocketReader::DoRead() {
while (true) {
read_buffer_ = new net::IOBuffer(kReadBufferSize);
int result = socket_->Read(
read_buffer_, kReadBufferSize, base::Bind(&SocketReader::OnRead,
weak_factory_.GetWeakPtr()));
read_buffer_.get(),
kReadBufferSize,
base::Bind(&SocketReader::OnRead, weak_factory_.GetWeakPtr()));
HandleReadResult(result);
if (result <= 0)
break;
......
......@@ -68,10 +68,16 @@ void ChromotingClient::Start(
// Create a WeakPtr to ourself for to use for all posted tasks.
weak_ptr_ = weak_factory_.GetWeakPtr();
connection_->Connect(xmpp_proxy, config_.local_jid, config_.host_jid,
config_.host_public_key, transport_factory.Pass(),
authenticator.Pass(), this, this, this,
rectangle_decoder_,
connection_->Connect(xmpp_proxy,
config_.local_jid,
config_.host_jid,
config_.host_public_key,
transport_factory.Pass(),
authenticator.Pass(),
this,
this,
this,
rectangle_decoder_.get(),
audio_decode_scheduler_.get());
}
......@@ -83,7 +89,7 @@ void ChromotingClient::Stop(const base::Closure& shutdown_task) {
}
FrameProducer* ChromotingClient::GetFrameProducer() {
return rectangle_decoder_;
return rectangle_decoder_.get();
}
void ChromotingClient::OnDisconnected(const base::Closure& shutdown_task) {
......
......@@ -28,7 +28,7 @@ void ClientContext::Stop() {
}
base::SingleThreadTaskRunner* ClientContext::main_task_runner() {
return main_task_runner_;
return main_task_runner_.get();
}
base::SingleThreadTaskRunner* ClientContext::decode_task_runner() {
......
......@@ -168,9 +168,8 @@ bool ChromotingInstance::ParseAuthMethods(const std::string& auth_methods_str,
ChromotingInstance::ChromotingInstance(PP_Instance pp_instance)
: pp::Instance(pp_instance),
initialized_(false),
plugin_task_runner_(
new PluginThreadTaskRunner(&plugin_thread_delegate_)),
context_(plugin_task_runner_),
plugin_task_runner_(new PluginThreadTaskRunner(&plugin_thread_delegate_)),
context_(plugin_task_runner_.get()),
input_tracker_(&mouse_input_filter_),
#if defined(OS_MACOSX)
// On Mac we need an extra filter to inject missing keyup events.
......@@ -646,7 +645,8 @@ void ChromotingInstance::Connect(const ClientConfig& config) {
// Setup the XMPP Proxy.
xmpp_proxy_ = new PepperXmppProxy(
base::Bind(&ChromotingInstance::SendOutgoingIq, AsWeakPtr()),
plugin_task_runner_, context_.main_task_runner());
plugin_task_runner_.get(),
context_.main_task_runner());
scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator(
PepperPortAllocator::Create(this));
......@@ -686,7 +686,7 @@ void ChromotingInstance::Disconnect() {
void ChromotingInstance::OnIncomingIq(const std::string& iq) {
// Just ignore the message if it's received before Connect() is called. It's
// likely to be a leftover from a previous session, so it's safe to ignore it.
if (xmpp_proxy_)
if (xmpp_proxy_.get())
xmpp_proxy_->OnIq(iq);
}
......
......@@ -79,13 +79,13 @@ void AudioCapturerLinux::OnDataRead(
}
bool AudioCapturer::IsSupported() {
return g_pulseaudio_pipe_sink_reader.Get() != NULL;
return g_pulseaudio_pipe_sink_reader.Get().get() != NULL;
}
scoped_ptr<AudioCapturer> AudioCapturer::Create() {
scoped_refptr<AudioPipeReader> reader =
g_pulseaudio_pipe_sink_reader.Get();
if (!reader)
if (!reader.get())
return scoped_ptr<AudioCapturer>();
return scoped_ptr<AudioCapturer>(new AudioCapturerLinux(reader));
}
......
......@@ -51,14 +51,13 @@ scoped_ptr<ChromotingHostContext> ChromotingHostContext::Create(
DCHECK(ui_task_runner->BelongsToCurrentThread());
scoped_ptr<ChromotingHostContext> context(
new ChromotingHostContext(ui_task_runner));
if (!context->audio_task_runner_ ||
!context->file_task_runner_ ||
!context->input_task_runner_ ||
!context->network_task_runner_ ||
!context->video_capture_task_runner_ ||
!context->video_encode_task_runner_ ||
!context->url_request_context_getter_) {
new ChromotingHostContext(ui_task_runner.get()));
if (!context->audio_task_runner_.get() || !context->file_task_runner_.get() ||
!context->input_task_runner_.get() ||
!context->network_task_runner_.get() ||
!context->video_capture_task_runner_.get() ||
!context->video_encode_task_runner_.get() ||
!context->url_request_context_getter_.get()) {
context.reset();
}
......
......@@ -86,11 +86,11 @@ ClientSession::ClientSession(
ClientSession::~ClientSession() {
DCHECK(CalledOnValidThread());
DCHECK(!audio_scheduler_);
DCHECK(!audio_scheduler_.get());
DCHECK(!desktop_environment_);
DCHECK(!input_injector_);
DCHECK(!screen_controls_);
DCHECK(!video_scheduler_);
DCHECK(!video_scheduler_.get());
connection_.reset();
}
......@@ -138,7 +138,7 @@ void ClientSession::ControlAudio(const protocol::AudioControl& audio_control) {
if (audio_control.has_enable()) {
VLOG(1) << "Received AudioControl (enable="
<< audio_control.enable() << ")";
if (audio_scheduler_)
if (audio_scheduler_.get())
audio_scheduler_->Pause(!audio_control.enable());
}
}
......@@ -176,11 +176,11 @@ void ClientSession::OnConnectionAuthenticated(
protocol::ConnectionToClient* connection) {
DCHECK(CalledOnValidThread());
DCHECK_EQ(connection_.get(), connection);
DCHECK(!audio_scheduler_);
DCHECK(!audio_scheduler_.get());
DCHECK(!desktop_environment_);
DCHECK(!input_injector_);
DCHECK(!screen_controls_);
DCHECK(!video_scheduler_);
DCHECK(!video_scheduler_.get());
auth_input_filter_.set_enabled(true);
auth_clipboard_filter_.set_enabled(true);
......@@ -311,11 +311,11 @@ void ClientSession::OnConnectionClosed(
// Stop components access the client, audio or video stubs, which are no
// longer valid once ConnectionToClient calls OnConnectionClosed().
if (audio_scheduler_) {
if (audio_scheduler_.get()) {
audio_scheduler_->Stop();
audio_scheduler_ = NULL;
}
if (video_scheduler_) {
if (video_scheduler_.get()) {
video_scheduler_->Stop();
video_scheduler_ = NULL;
}
......@@ -335,7 +335,7 @@ void ClientSession::OnSequenceNumberUpdated(
DCHECK(CalledOnValidThread());
DCHECK_EQ(connection_.get(), connection);
if (video_scheduler_)
if (video_scheduler_.get())
video_scheduler_->UpdateSequenceNumber(sequence_number);
event_handler_->OnSessionSequenceNumber(this, sequence_number);
......
......@@ -36,7 +36,7 @@ DesktopProcess::DesktopProcess(
DesktopProcess::~DesktopProcess() {
DCHECK(!daemon_channel_);
DCHECK(!desktop_agent_);
DCHECK(!desktop_agent_.get());
}
DesktopEnvironmentFactory& DesktopProcess::desktop_environment_factory() {
......@@ -79,7 +79,7 @@ void DesktopProcess::OnChannelConnected(int32 peer_pid) {
void DesktopProcess::OnChannelError() {
// Shutdown the desktop process.
daemon_channel_.reset();
if (desktop_agent_) {
if (desktop_agent_.get()) {
desktop_agent_->Stop();
desktop_agent_ = NULL;
}
......@@ -142,7 +142,7 @@ bool DesktopProcess::Start(
daemon_channel_.reset(new IPC::ChannelProxy(daemon_channel_name_,
IPC::Channel::MODE_CLIENT,
this,
io_task_runner));
io_task_runner.get()));
// Pass |desktop_pipe| to the daemon.
daemon_channel_->Send(
......
......@@ -176,11 +176,10 @@ void DesktopProcessTest::ConnectNetworkChannel(
IPC::ChannelHandle channel_handle(desktop_process);
#endif // defined(OS_WIN)
network_channel_.reset(new IPC::ChannelProxy(
channel_handle,
IPC::Channel::MODE_CLIENT,
&network_listener_,
io_task_runner_));
network_channel_.reset(new IPC::ChannelProxy(channel_handle,
IPC::Channel::MODE_CLIENT,
&network_listener_,
io_task_runner_.get()));
}
void DesktopProcessTest::OnDesktopAttached(
......@@ -248,11 +247,10 @@ void DesktopProcessTest::RunDesktopProcess() {
"IPC thread", ui_task_runner, base::MessageLoop::TYPE_IO);
std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID();
daemon_channel_.reset(new IPC::ChannelProxy(
IPC::ChannelHandle(channel_name),
IPC::Channel::MODE_SERVER,
&daemon_listener_,
io_task_runner_));
daemon_channel_.reset(new IPC::ChannelProxy(IPC::ChannelHandle(channel_name),
IPC::Channel::MODE_SERVER,
&daemon_listener_,
io_task_runner_.get()));
scoped_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory(
new MockDesktopEnvironmentFactory());
......
......@@ -253,7 +253,7 @@ bool DesktopSessionProxy::AttachToDesktop(
desktop_channel_.reset(new IPC::ChannelProxy(desktop_channel_handle,
IPC::Channel::MODE_CLIENT,
this,
io_task_runner_));
io_task_runner_.get()));
// Pass ID of the client (which is authenticated at this point) to the desktop
// session agent and start the agent.
......@@ -469,7 +469,7 @@ void DesktopSessionProxy::OnCaptureCompleted(
// a more privileged process.
scoped_refptr<IpcSharedBufferCore> shared_buffer_core =
GetSharedBufferCore(serialized_frame.shared_buffer_id);
CHECK(shared_buffer_core);
CHECK(shared_buffer_core.get());
scoped_ptr<webrtc::DesktopFrame> frame(
new webrtc::SharedMemoryDesktopFrame(
......
......@@ -65,7 +65,7 @@ HeartbeatSender::HeartbeatSender(
heartbeat_succeeded_(false),
failed_startup_heartbeat_count_(0) {
DCHECK(signal_strategy_);
DCHECK(key_pair_);
DCHECK(key_pair_.get());
signal_strategy_->AddListener(this);
......
......@@ -59,7 +59,7 @@ class HeartbeatSenderTest
virtual void SetUp() OVERRIDE {
key_pair_ = RsaKeyPair::FromString(kTestRsaKeyPair);
ASSERT_TRUE(key_pair_);
ASSERT_TRUE(key_pair_.get());
EXPECT_CALL(signal_strategy_, GetState())
.WillOnce(Return(SignalStrategy::DISCONNECTED));
......@@ -238,7 +238,7 @@ void HeartbeatSenderTest::ValidateHeartbeatStanza(
EXPECT_TRUE(heartbeat_stanza->NextNamed(signature_tag) == NULL);
scoped_refptr<RsaKeyPair> key_pair = RsaKeyPair::FromString(kTestRsaKeyPair);
ASSERT_TRUE(key_pair);
ASSERT_TRUE(key_pair.get());
std::string expected_signature =
key_pair->SignMessage(std::string(kTestJid) + ' ' + expectedSequenceId);
EXPECT_EQ(expected_signature, signature->BodyText());
......
......@@ -96,9 +96,9 @@ void HostPortAllocatorSession::SendSessionRequest(const std::string& host,
GetSessionRequestUrl() + "&sn=1");
scoped_ptr<net::URLFetcher> url_fetcher(
net::URLFetcher::Create(url, net::URLFetcher::GET, this));
url_fetcher->SetRequestContext(url_context_);
url_fetcher->AddExtraRequestHeader(
"X-Talk-Google-Relay-Auth: " + relay_token());
url_fetcher->SetRequestContext(url_context_.get());
url_fetcher->AddExtraRequestHeader("X-Talk-Google-Relay-Auth: " +
relay_token());
url_fetcher->AddExtraRequestHeader("X-Google-Relay-Auth: " + relay_token());
url_fetcher->AddExtraRequestHeader("X-Stream-Type: chromoting");
url_fetcher->Start();
......
......@@ -364,16 +364,16 @@ void IpcDesktopEnvironmentTest::ReflectClipboardEvent(
}
void IpcDesktopEnvironmentTest::CreateDesktopProcess() {
EXPECT_TRUE(task_runner_);
EXPECT_TRUE(io_task_runner_);
EXPECT_TRUE(task_runner_.get());
EXPECT_TRUE(io_task_runner_.get());
// Create the daemon end of the daemon-to-desktop channel.
desktop_channel_name_ = IPC::Channel::GenerateUniqueRandomChannelID();
desktop_channel_.reset(new IPC::ChannelProxy(
IPC::ChannelHandle(desktop_channel_name_),
IPC::Channel::MODE_SERVER,
&desktop_listener_,
io_task_runner_));
desktop_channel_.reset(
new IPC::ChannelProxy(IPC::ChannelHandle(desktop_channel_name_),
IPC::Channel::MODE_SERVER,
&desktop_listener_,
io_task_runner_.get()));
// Create and start the desktop process.
desktop_process_.reset(new DesktopProcess(task_runner_,
......
......@@ -45,11 +45,10 @@ bool CreateConnectedIpcChannel(
// Wrap the pipe into an IPC channel.
base::FileDescriptor fd(pipe_fds[0], false);
IPC::ChannelHandle handle(socket_name, fd);
server_out->reset(new IPC::ChannelProxy(
IPC::ChannelHandle(socket_name, fd),
IPC::Channel::MODE_SERVER,
listener,
io_task_runner));
server_out->reset(new IPC::ChannelProxy(IPC::ChannelHandle(socket_name, fd),
IPC::Channel::MODE_SERVER,
listener,
io_task_runner.get()));
*client_out = base::FileDescriptor(pipe_fds[1], false);
return true;
......
......@@ -868,7 +868,7 @@ bool HostNPScriptObject::SetProperty(const std::string& property_name,
if (property_name == kAttrNameOnNatTraversalPolicyChanged) {
if (NPVARIANT_IS_OBJECT(*value)) {
on_nat_traversal_policy_changed_func_ = NPVARIANT_TO_OBJECT(*value);
if (it2me_impl_) {
if (it2me_impl_.get()) {
// Ask the It2Me implementation to notify the web-app of the policy.
it2me_impl_->RequestNatPolicy();
}
......@@ -1004,7 +1004,7 @@ bool HostNPScriptObject::Connect(const NPVariant* args,
return false;
}
if (it2me_impl_) {
if (it2me_impl_.get()) {
SetException("connect: can be called only when disconnected");
return false;
}
......@@ -1051,7 +1051,7 @@ bool HostNPScriptObject::Disconnect(const NPVariant* args,
return false;
}
if (it2me_impl_) {
if (it2me_impl_.get()) {
it2me_impl_->Disconnect();
it2me_impl_ = NULL;
}
......
......@@ -44,7 +44,7 @@ RegisterSupportHostRequest::RegisterSupportHostRequest(
directory_bot_jid_(directory_bot_jid),
callback_(callback) {
DCHECK(signal_strategy_);
DCHECK(key_pair_);
DCHECK(key_pair_.get());
signal_strategy_->AddListener(this);
iq_sender_.reset(new IqSender(signal_strategy_));
}
......
......@@ -59,7 +59,7 @@ class RegisterSupportHostRequestTest : public testing::Test {
protected:
virtual void SetUp() {
key_pair_ = RsaKeyPair::FromString(kTestRsaKeyPair);
ASSERT_TRUE(key_pair_);
ASSERT_TRUE(key_pair_.get());
EXPECT_CALL(signal_strategy_, AddListener(NotNull()))
.WillRepeatedly(AddListener(&signal_strategy_listeners_));
......@@ -120,7 +120,7 @@ TEST_F(RegisterSupportHostRequestTest, Send) {
EXPECT_GE(now, time);
scoped_refptr<RsaKeyPair> key_pair = RsaKeyPair::FromString(kTestRsaKeyPair);
ASSERT_TRUE(key_pair);
ASSERT_TRUE(key_pair.get());
std::string expected_signature =
key_pair->SignMessage(std::string(kTestJid) + ' ' + time_str);
......