Commit afce9782 authored by sergeyu's avatar sergeyu Committed by Commit bot

Cleanup usage of scoped_ptr<> in remoting for C++11

 - Use nullptr to initialize null scoped_ptr().
 - use Pass(), PassAs() is no longer required.

Review URL: https://codereview.chromium.org/609923004

Cr-Commit-Position: refs/heads/master@{#297236}
parent 7461dcda
......@@ -400,10 +400,8 @@ void ChromotingJniInstance::ConnectToHostOnNetworkThread() {
view_->set_frame_producer(renderer);
video_renderer_.reset(renderer);
client_.reset(new ChromotingClient(client_context_.get(),
this,
video_renderer_.get(),
scoped_ptr<AudioPlayer>()));
client_.reset(new ChromotingClient(
client_context_.get(), this, video_renderer_.get(), nullptr));
signaling_.reset(new XmppSignalStrategy(
net::ClientSocketFactory::GetDefaultFactory(),
......@@ -424,9 +422,7 @@ void ChromotingJniInstance::ConnectToHostOnNetworkThread() {
scoped_ptr<protocol::TransportFactory> transport_factory(
new protocol::LibjingleTransportFactory(
signaling_.get(),
port_allocator.PassAs<cricket::HttpPortAllocatorBase>(),
network_settings));
signaling_.get(), port_allocator.Pass(), network_settings));
client_->Start(signaling_.get(), authenticator_.Pass(),
transport_factory.Pass(), host_jid_, capabilities_);
......
......@@ -629,7 +629,7 @@ void ChromotingInstance::SetCursorShape(
dictionary.Set(pp::Var("hotspotY"), cursor_hotspot.y());
dictionary.Set(pp::Var("data"), array_buffer);
PostChromotingMessage("setCursorShape", dictionary);
input_handler_.SetMouseCursor(scoped_ptr<pp::ImageData>(), cursor_hotspot);
input_handler_.SetMouseCursor(nullptr, cursor_hotspot);
} else {
if (delegate_large_cursors_) {
pp::VarDictionary dictionary;
......@@ -759,8 +759,7 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) {
scoped_ptr<protocol::TransportFactory> transport_factory(
new protocol::LibjingleTransportFactory(
signal_strategy_.get(),
PepperPortAllocator::Create(this)
.PassAs<cricket::HttpPortAllocatorBase>(),
PepperPortAllocator::Create(this).Pass(),
protocol::NetworkSettings(
protocol::NetworkSettings::NAT_TRAVERSAL_FULL)));
......
......@@ -22,7 +22,7 @@ scoped_ptr<AudioDecoder> AudioDecoder::CreateAudioDecoder(
}
NOTIMPLEMENTED();
return scoped_ptr<AudioDecoder>();
return nullptr;
}
} // namespace remoting
......@@ -81,15 +81,15 @@ scoped_ptr<AudioPacket> AudioDecoderOpus::Decode(
if (packet->encoding() != AudioPacket::ENCODING_OPUS) {
LOG(WARNING) << "Received an audio packet with encoding "
<< packet->encoding() << " when an OPUS packet was expected.";
return scoped_ptr<AudioPacket>();
return nullptr;
}
if (packet->data_size() > kMaxFramesPerPacket) {
LOG(WARNING) << "Received an packet with too many frames.";
return scoped_ptr<AudioPacket>();
return nullptr;
}
if (!ResetForPacket(packet.get())) {
return scoped_ptr<AudioPacket>();
return nullptr;
}
// Create a new packet of decoded data.
......@@ -121,7 +121,7 @@ scoped_ptr<AudioPacket> AudioDecoderOpus::Decode(
if (result < 0) {
LOG(ERROR) << "Failed decoding Opus frame. Error code: " << result;
DestroyDecoder();
return scoped_ptr<AudioPacket>();
return nullptr;
}
buffer_pos += result * packet->channels() *
......@@ -129,7 +129,7 @@ scoped_ptr<AudioPacket> AudioDecoderOpus::Decode(
}
if (!buffer_pos) {
return scoped_ptr<AudioPacket>();
return nullptr;
}
decoded_data->resize(buffer_pos);
......
......@@ -26,7 +26,7 @@ scoped_ptr<AudioPacket> AudioDecoderVerbatim::Decode(
(packet->data(0).size() %
(AudioPacket::CHANNELS_STEREO * AudioPacket::BYTES_PER_SAMPLE_2) != 0)) {
LOG(WARNING) << "Verbatim decoder received an invalid packet.";
return scoped_ptr<AudioPacket>();
return nullptr;
}
return packet.Pass();
}
......
......@@ -142,7 +142,7 @@ scoped_ptr<AudioPacket> AudioEncoderOpus::Encode(
if (!ResetForPacket(packet.get())) {
LOG(ERROR) << "Encoder initialization failed";
return scoped_ptr<AudioPacket>();
return nullptr;
}
int samples_in_packet = packet->data(0).size() / kBytesPerSample / channels_;
......@@ -200,7 +200,7 @@ scoped_ptr<AudioPacket> AudioEncoderOpus::Encode(
buffer, data->length());
if (result < 0) {
LOG(ERROR) << "opus_encode() failed with error code: " << result;
return scoped_ptr<AudioPacket>();
return nullptr;
}
DCHECK_LE(result, static_cast<int>(data->length()));
......@@ -230,7 +230,7 @@ scoped_ptr<AudioPacket> AudioEncoderOpus::Encode(
// Return NULL if there's nothing in the packet.
if (encoded_packet->data_size() == 0)
return scoped_ptr<AudioPacket>();
return nullptr;
return encoded_packet.Pass();
}
......
......@@ -56,7 +56,7 @@ scoped_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP8() {
vpx_codec_dec_init(codec.get(), vpx_codec_vp8_dx(), &config, 0);
if (ret != VPX_CODEC_OK) {
LOG(ERROR) << "Cannot initialize codec.";
return scoped_ptr<VideoDecoderVpx>();
return nullptr;
}
return scoped_ptr<VideoDecoderVpx>(new VideoDecoderVpx(codec.Pass()));
......@@ -76,7 +76,7 @@ scoped_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP9() {
vpx_codec_dec_init(codec.get(), vpx_codec_vp9_dx(), &config, 0);
if (ret != VPX_CODEC_OK) {
LOG(ERROR) << "Cannot initialize codec.";
return scoped_ptr<VideoDecoderVpx>();
return nullptr;
}
return scoped_ptr<VideoDecoderVpx>(new VideoDecoderVpx(codec.Pass()));
......
......@@ -83,7 +83,7 @@ scoped_ptr<AudioCapturer> AudioCapturer::Create() {
scoped_refptr<AudioPipeReader> reader =
g_pulseaudio_pipe_sink_reader.Get();
if (!reader.get())
return scoped_ptr<AudioCapturer>();
return nullptr;
return scoped_ptr<AudioCapturer>(new AudioCapturerLinux(reader));
}
......
......@@ -13,7 +13,7 @@ bool AudioCapturer::IsSupported() {
scoped_ptr<AudioCapturer> AudioCapturer::Create() {
NOTIMPLEMENTED();
return scoped_ptr<AudioCapturer>();
return nullptr;
}
} // namespace remoting
......@@ -37,7 +37,7 @@ scoped_ptr<InputInjector> BasicDesktopEnvironment::CreateInputInjector() {
scoped_ptr<ScreenControls> BasicDesktopEnvironment::CreateScreenControls() {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
return scoped_ptr<ScreenControls>();
return nullptr;
}
scoped_ptr<webrtc::MouseCursorMonitor>
......@@ -57,7 +57,7 @@ void BasicDesktopEnvironment::SetCapabilities(const std::string& capabilities) {
scoped_ptr<GnubbyAuthHandler> BasicDesktopEnvironment::CreateGnubbyAuthHandler(
protocol::ClientStub* client_stub) {
return scoped_ptr<GnubbyAuthHandler>();
return nullptr;
}
scoped_ptr<webrtc::DesktopCapturer>
......
......@@ -35,8 +35,7 @@ scoped_ptr<HostExtensionSession> CastExtension::CreateExtensionSession(
url_request_context_getter_,
network_settings_,
client_session_control,
client_stub)
.PassAs<HostExtensionSession>();
client_stub).Pass();
}
} // namespace remoting
......
......@@ -185,11 +185,9 @@ scoped_ptr<CastExtensionSession> CastExtensionSession::Create(
network_settings,
client_session_control,
client_stub));
if (!cast_extension_session->WrapTasksAndSave()) {
return scoped_ptr<CastExtensionSession>();
}
if (!cast_extension_session->InitializePeerConnection()) {
return scoped_ptr<CastExtensionSession>();
if (!cast_extension_session->WrapTasksAndSave() ||
!cast_extension_session->InitializePeerConnection()) {
return nullptr;
}
return cast_extension_session.Pass();
}
......
......@@ -182,8 +182,8 @@ class ChromotingHostTest : public testing::Test {
void SimulateClientConnection(int connection_index, bool authenticate,
bool reject) {
scoped_ptr<protocol::ConnectionToClient> connection =
((connection_index == 0) ? owned_connection1_ : owned_connection2_).
PassAs<protocol::ConnectionToClient>();
((connection_index == 0) ? owned_connection1_ : owned_connection2_)
.Pass();
protocol::ConnectionToClient* connection_ptr = connection.get();
scoped_ptr<ClientSession> client(new ClientSession(
host_.get(),
......
......@@ -494,15 +494,15 @@ scoped_ptr<VideoEncoder> ClientSession::CreateVideoEncoder(
const protocol::ChannelConfig& video_config = config.video_config();
if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) {
return remoting::VideoEncoderVpx::CreateForVP8().PassAs<VideoEncoder>();
return remoting::VideoEncoderVpx::CreateForVP8().Pass();
} else if (video_config.codec == protocol::ChannelConfig::CODEC_VP9) {
return remoting::VideoEncoderVpx::CreateForVP9().PassAs<VideoEncoder>();
return remoting::VideoEncoderVpx::CreateForVP9().Pass();
} else if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) {
return scoped_ptr<VideoEncoder>(new remoting::VideoEncoderVerbatim());
return make_scoped_ptr(new remoting::VideoEncoderVerbatim());
}
NOTREACHED();
return scoped_ptr<VideoEncoder>();
return nullptr;
}
// static
......@@ -517,7 +517,7 @@ scoped_ptr<AudioEncoder> ClientSession::CreateAudioEncoder(
}
NOTREACHED();
return scoped_ptr<AudioEncoder>();
return nullptr;
}
} // namespace remoting
......@@ -254,7 +254,7 @@ void ClientSessionTest::CreateClientSession() {
task_runner_, // Encode thread.
task_runner_, // Network thread.
task_runner_, // UI thread.
connection.PassAs<protocol::ConnectionToClient>(),
connection.Pass(),
desktop_environment_factory_.get(),
base::TimeDelta(),
NULL,
......
......@@ -221,8 +221,7 @@ void DaemonProcessWin::LaunchNetworkProcess() {
scoped_ptr<UnprivilegedProcessDelegate> delegate(
new UnprivilegedProcessDelegate(io_task_runner(), target.Pass()));
network_launcher_.reset(new WorkerProcessLauncher(
delegate.PassAs<WorkerProcessLauncher::Delegate>(), this));
network_launcher_.reset(new WorkerProcessLauncher(delegate.Pass(), this));
}
scoped_ptr<DaemonProcess> DaemonProcess::Create(
......@@ -233,7 +232,7 @@ scoped_ptr<DaemonProcess> DaemonProcess::Create(
new DaemonProcessWin(caller_task_runner, io_task_runner,
stopped_callback));
daemon_process->Initialize();
return daemon_process.PassAs<DaemonProcess>();
return daemon_process.Pass();
}
void DaemonProcessWin::DisableAutoStart() {
......
......@@ -262,8 +262,7 @@ void DesktopProcessTest::RunDesktopProcess() {
.WillRepeatedly(Return(false));
DesktopProcess desktop_process(ui_task_runner, io_task_runner_, channel_name);
EXPECT_TRUE(desktop_process.Start(
desktop_environment_factory.PassAs<DesktopEnvironmentFactory>()));
EXPECT_TRUE(desktop_process.Start(desktop_environment_factory.Pass()));
ui_task_runner = NULL;
run_loop.Run();
......
......@@ -75,7 +75,7 @@ class DesktopSessionAgent::SharedBuffer : public webrtc::SharedMemory {
int id) {
scoped_ptr<base::SharedMemory> memory(new base::SharedMemory());
if (!memory->CreateAndMapAnonymous(size))
return scoped_ptr<SharedBuffer>();
return nullptr;
return scoped_ptr<SharedBuffer>(
new SharedBuffer(agent, memory.Pass(), size, id));
}
......
......@@ -291,7 +291,7 @@ void DesktopSessionProxy::DetachFromDesktop() {
// Generate fake responses to keep the video capturer in sync.
while (pending_capture_frame_requests_) {
--pending_capture_frame_requests_;
PostCaptureCompleted(scoped_ptr<webrtc::DesktopFrame>());
PostCaptureCompleted(nullptr);
}
}
......@@ -313,7 +313,7 @@ void DesktopSessionProxy::CaptureFrame() {
++pending_capture_frame_requests_;
SendToDesktop(new ChromotingNetworkDesktopMsg_CaptureFrame());
} else {
PostCaptureCompleted(scoped_ptr<webrtc::DesktopFrame>());
PostCaptureCompleted(nullptr);
}
}
......
......@@ -375,7 +375,7 @@ scoped_ptr<DesktopSession> DesktopSessionWin::CreateForConsole(
caller_task_runner, io_task_runner, daemon_process, id,
HostService::GetInstance()));
return session.PassAs<DesktopSession>();
return session.Pass();
}
// static
......@@ -389,9 +389,9 @@ scoped_ptr<DesktopSession> DesktopSessionWin::CreateForVirtualTerminal(
caller_task_runner, io_task_runner, daemon_process, id,
HostService::GetInstance()));
if (!session->Initialize(resolution))
return scoped_ptr<DesktopSession>();
return nullptr;
return session.PassAs<DesktopSession>();
return session.Pass();
}
DesktopSessionWin::DesktopSessionWin(
......@@ -552,8 +552,7 @@ void DesktopSessionWin::OnSessionAttached(uint32 session_id) {
}
// Create a launcher for the desktop process, using the per-session delegate.
launcher_.reset(new WorkerProcessLauncher(
delegate.PassAs<WorkerProcessLauncher::Delegate>(), this));
launcher_.reset(new WorkerProcessLauncher(delegate.Pass(), this));
}
void DesktopSessionWin::OnSessionDetached() {
......
......@@ -11,7 +11,7 @@ namespace remoting {
scoped_ptr<DesktopShapeTracker> DesktopShapeTracker::Create(
webrtc::DesktopCaptureOptions options) {
return scoped_ptr<DesktopShapeTracker>();
return nullptr;
}
} // namespace remoting
......@@ -11,7 +11,7 @@ namespace remoting {
scoped_ptr<DesktopShapeTracker> DesktopShapeTracker::Create(
webrtc::DesktopCaptureOptions options) {
return scoped_ptr<DesktopShapeTracker>();
return nullptr;
}
} // namespace remoting
......@@ -44,7 +44,7 @@ FakeDesktopEnvironment::~FakeDesktopEnvironment() {}
// DesktopEnvironment implementation.
scoped_ptr<AudioCapturer> FakeDesktopEnvironment::CreateAudioCapturer() {
return scoped_ptr<AudioCapturer>();
return nullptr;
}
scoped_ptr<InputInjector> FakeDesktopEnvironment::CreateInputInjector() {
......@@ -60,7 +60,7 @@ FakeDesktopEnvironment::CreateVideoCapturer() {
scoped_ptr<FakeDesktopCapturer> result(new FakeDesktopCapturer());
if (!frame_generator_.is_null())
result->set_frame_generator(frame_generator_);
return result.PassAs<webrtc::DesktopCapturer>();
return result.Pass();
}
scoped_ptr<webrtc::MouseCursorMonitor>
......@@ -76,7 +76,7 @@ void FakeDesktopEnvironment::SetCapabilities(const std::string& capabilities) {}
scoped_ptr<GnubbyAuthHandler> FakeDesktopEnvironment::CreateGnubbyAuthHandler(
protocol::ClientStub* client_stub) {
return scoped_ptr<GnubbyAuthHandler>();
return nullptr;
}
FakeDesktopEnvironmentFactory::FakeDesktopEnvironmentFactory() {}
......@@ -87,7 +87,7 @@ scoped_ptr<DesktopEnvironment> FakeDesktopEnvironmentFactory::Create(
base::WeakPtr<ClientSessionControl> client_session_control) {
scoped_ptr<FakeDesktopEnvironment> result(new FakeDesktopEnvironment());
result->set_frame_generator(frame_generator_);
return result.PassAs<DesktopEnvironment>();
return result.Pass();
}
void FakeDesktopEnvironmentFactory::SetEnableCurtaining(bool enable) {}
......
......@@ -25,7 +25,7 @@ class GnubbyAuthHandlerWin : public GnubbyAuthHandler {
// static
scoped_ptr<GnubbyAuthHandler> GnubbyAuthHandler::Create(
protocol::ClientStub* client_stub) {
return scoped_ptr<GnubbyAuthHandler>();
return nullptr;
}
// static
......
......@@ -607,8 +607,8 @@ scoped_ptr<InputInjector> InputInjector::Create(
scoped_ptr<InputInjectorLinux> injector(
new InputInjectorLinux(main_task_runner));
if (!injector->Init())
return scoped_ptr<InputInjector>();
return injector.PassAs<InputInjector>();
return nullptr;
return injector.Pass();
}
} // namespace remoting
......@@ -78,7 +78,7 @@ void IpcDesktopEnvironment::SetCapabilities(const std::string& capabilities) {
scoped_ptr<GnubbyAuthHandler> IpcDesktopEnvironment::CreateGnubbyAuthHandler(
protocol::ClientStub* client_stub) {
return scoped_ptr<GnubbyAuthHandler>();
return nullptr;
}
IpcDesktopEnvironmentFactory::IpcDesktopEnvironmentFactory(
......
......@@ -402,8 +402,7 @@ void IpcDesktopEnvironmentTest::CreateDesktopProcess() {
.Times(AnyNumber())
.WillRepeatedly(Return(false));
EXPECT_TRUE(desktop_process_->Start(
desktop_environment_factory.PassAs<DesktopEnvironmentFactory>()));
EXPECT_TRUE(desktop_process_->Start(desktop_environment_factory.Pass()));
}
void IpcDesktopEnvironmentTest::DestoyDesktopProcess() {
......@@ -435,7 +434,7 @@ TEST_F(IpcDesktopEnvironmentTest, Basic) {
.Times(0);
// Start the input injector and screen capturer.
input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>());
input_injector_->Start(clipboard_stub.Pass());
// Run the message loop until the desktop is attached.
setup_run_loop_->Run();
......@@ -456,7 +455,7 @@ TEST_F(IpcDesktopEnvironmentTest, CaptureFrame) {
.Times(0);
// Start the input injector and screen capturer.
input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>());
input_injector_->Start(clipboard_stub.Pass());
video_capturer_->Start(&desktop_capturer_callback_);
// Run the message loop until the desktop is attached.
......@@ -485,7 +484,7 @@ TEST_F(IpcDesktopEnvironmentTest, Reattach) {
.Times(0);
// Start the input injector and screen capturer.
input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>());
input_injector_->Start(clipboard_stub.Pass());
video_capturer_->Start(&desktop_capturer_callback_);
// Run the message loop until the desktop is attached.
......@@ -518,7 +517,7 @@ TEST_F(IpcDesktopEnvironmentTest, InjectClipboardEvent) {
this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment));
// Start the input injector and screen capturer.
input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>());
input_injector_->Start(clipboard_stub.Pass());
video_capturer_->Start(&desktop_capturer_callback_);
// Run the message loop until the desktop is attached.
......@@ -549,7 +548,7 @@ TEST_F(IpcDesktopEnvironmentTest, InjectKeyEvent) {
.Times(0);
// Start the input injector and screen capturer.
input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>());
input_injector_->Start(clipboard_stub.Pass());
video_capturer_->Start(&desktop_capturer_callback_);
// Run the message loop until the desktop is attached.
......@@ -580,7 +579,7 @@ TEST_F(IpcDesktopEnvironmentTest, InjectTextEvent) {
.Times(0);
// Start the input injector and screen capturer.
input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>());
input_injector_->Start(clipboard_stub.Pass());
video_capturer_->Start(&desktop_capturer_callback_);
// Run the message loop until the desktop is attached.
......@@ -610,7 +609,7 @@ TEST_F(IpcDesktopEnvironmentTest, InjectMouseEvent) {
.Times(0);
// Start the input injector and screen capturer.
input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>());
input_injector_->Start(clipboard_stub.Pass());
video_capturer_->Start(&desktop_capturer_callback_);
// Run the message loop until the desktop is attached.
......@@ -641,7 +640,7 @@ TEST_F(IpcDesktopEnvironmentTest, SetScreenResolution) {
.Times(0);
// Start the input injector and screen capturer.
input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>());
input_injector_->Start(clipboard_stub.Pass());
video_capturer_->Start(&desktop_capturer_callback_);
// Run the message loop until the desktop is attached.
......
......@@ -132,7 +132,7 @@ void It2MeNativeMessagingHost::ProcessHello(
scoped_ptr<base::ListValue> supported_features_list(new base::ListValue());
response->Set("supportedFeatures", supported_features_list.release());
channel_->SendMessage(response.PassAs<base::Value>());
channel_->SendMessage(response.Pass());
}
void It2MeNativeMessagingHost::ProcessConnect(
......@@ -206,7 +206,7 @@ void It2MeNativeMessagingHost::ProcessConnect(
directory_bot_jid_);
it2me_host_->Connect();
channel_->SendMessage(response.PassAs<base::Value>());
channel_->SendMessage(response.Pass());
}
void It2MeNativeMessagingHost::ProcessDisconnect(
......@@ -218,7 +218,7 @@ void It2MeNativeMessagingHost::ProcessDisconnect(
it2me_host_->Disconnect();
it2me_host_ = NULL;
}
channel_->SendMessage(response.PassAs<base::Value>());
channel_->SendMessage(response.Pass());
}
void It2MeNativeMessagingHost::SendErrorAndExit(
......@@ -230,10 +230,10 @@ void It2MeNativeMessagingHost::SendErrorAndExit(
response->SetString("type", "error");
response->SetString("description", description);
channel_->SendMessage(response.PassAs<base::Value>());
channel_->SendMessage(response.Pass());
// Trigger a host shutdown by sending a NULL message.
channel_->SendMessage(scoped_ptr<base::Value>());
channel_->SendMessage(nullptr);
}
void It2MeNativeMessagingHost::OnStateChanged(It2MeHostState state) {
......@@ -266,7 +266,7 @@ void It2MeNativeMessagingHost::OnStateChanged(It2MeHostState state) {
;
}
channel_->SendMessage(message.PassAs<base::Value>());
channel_->SendMessage(message.Pass());
}
void It2MeNativeMessagingHost::OnNatPolicyChanged(bool nat_traversal_enabled) {
......@@ -276,7 +276,7 @@ void It2MeNativeMessagingHost::OnNatPolicyChanged(bool nat_traversal_enabled) {
message->SetString("type", "natPolicyChanged");
message->SetBoolean("natTraversalEnabled", nat_traversal_enabled);
channel_->SendMessage(message.PassAs<base::Value>());
channel_->SendMessage(message.Pass());
}
// Stores the Access Code for the web-app to query.
......
......@@ -261,7 +261,7 @@ It2MeNativeMessagingHostTest::ReadMessageFromOutputPipe() {
reinterpret_cast<char*>(&length), sizeof(length));
if (read_result != sizeof(length)) {
// The output pipe has been closed, return an empty message.
return scoped_ptr<base::DictionaryValue>();
return nullptr;
}
std::string message_json(length, '\0');
......@@ -270,13 +270,13 @@ It2MeNativeMessagingHostTest::ReadMessageFromOutputPipe() {
if (read_result != static_cast<int>(length)) {
LOG(ERROR) << "Message size (" << read_result
<< ") doesn't match the header (" << length << ").";
return scoped_ptr<base::DictionaryValue>();
return nullptr;
}
scoped_ptr<base::Value> message(base::JSONReader::Read(message_json));
if (!message || !message->IsType(base::Value::TYPE_DICTIONARY)) {
LOG(ERROR) << "Malformed message:" << message_json;
return scoped_ptr<base::DictionaryValue>();
return nullptr;
}
return scoped_ptr<base::DictionaryValue>(
......
......@@ -65,7 +65,7 @@ scoped_ptr<GnubbyAuthHandler> Me2MeDesktopEnvironment::CreateGnubbyAuthHandler(
GnubbyAuthHandler::Create(client_stub));
HOST_LOG << "gnubby auth is not enabled";
return scoped_ptr<GnubbyAuthHandler>();
return nullptr;
}
bool Me2MeDesktopEnvironment::InitializeSecurity(
......@@ -148,11 +148,11 @@ scoped_ptr<DesktopEnvironment> Me2MeDesktopEnvironmentFactory::Create(
ui_task_runner()));
if (!desktop_environment->InitializeSecurity(client_session_control,
curtain_enabled_)) {
return scoped_ptr<DesktopEnvironment>();
return nullptr;
}
desktop_environment->SetEnableGnubbyAuth(gnubby_auth_enabled_);
return desktop_environment.PassAs<DesktopEnvironment>();
return desktop_environment.Pass();
}
void Me2MeDesktopEnvironmentFactory::SetEnableCurtaining(bool enable) {
......
......@@ -11,7 +11,7 @@ namespace remoting {
using protocol::PairingRegistry;
scoped_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() {
return scoped_ptr<PairingRegistry::Delegate>();
return nullptr;
}
} // namespace remoting
......@@ -44,7 +44,7 @@ scoped_ptr<base::DictionaryValue> ReadValue(const base::win::RegKey& key,
if (result != ERROR_SUCCESS) {
SetLastError(result);
PLOG(ERROR) << "Cannot read value '" << value_name << "'";
return scoped_ptr<base::DictionaryValue>();
return nullptr;
}
// Parse the value.
......@@ -57,12 +57,12 @@ scoped_ptr<base::DictionaryValue> ReadValue(const base::win::RegKey& key,
if (!value) {
LOG(ERROR) << "Failed to parse '" << value_name << "': " << error_message
<< " (" << error_code << ").";
return scoped_ptr<base::DictionaryValue>();
return nullptr;
}
if (value->GetType() != base::Value::TYPE_DICTIONARY) {
LOG(ERROR) << "Failed to parse '" << value_name << "': not a dictionary.";
return scoped_ptr<base::DictionaryValue>();
return nullptr;
}