diff options
author | sergeyu <sergeyu@chromium.org> | 2014-09-29 12:38:30 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-29 19:38:43 +0000 |
commit | afce97826070950bca497ce147a30312ce780e74 (patch) | |
tree | 5d9741c3c98c97427665687d83561d709a2ca222 | |
parent | 7461dcda6673ccd78b82efc4719e1389fc0c215b (diff) | |
download | chromium_src-afce97826070950bca497ce147a30312ce780e74.zip chromium_src-afce97826070950bca497ce147a30312ce780e74.tar.gz chromium_src-afce97826070950bca497ce147a30312ce780e74.tar.bz2 |
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}
66 files changed, 151 insertions, 175 deletions
diff --git a/remoting/client/jni/chromoting_jni_instance.cc b/remoting/client/jni/chromoting_jni_instance.cc index a8d1d27..1a69115 100644 --- a/remoting/client/jni/chromoting_jni_instance.cc +++ b/remoting/client/jni/chromoting_jni_instance.cc @@ -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_); diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc index 4b1e996..e28d5c4 100644 --- a/remoting/client/plugin/chromoting_instance.cc +++ b/remoting/client/plugin/chromoting_instance.cc @@ -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))); diff --git a/remoting/codec/audio_decoder.cc b/remoting/codec/audio_decoder.cc index 26e13eb..20e7d8b 100644 --- a/remoting/codec/audio_decoder.cc +++ b/remoting/codec/audio_decoder.cc @@ -22,7 +22,7 @@ scoped_ptr<AudioDecoder> AudioDecoder::CreateAudioDecoder( } NOTIMPLEMENTED(); - return scoped_ptr<AudioDecoder>(); + return nullptr; } } // namespace remoting diff --git a/remoting/codec/audio_decoder_opus.cc b/remoting/codec/audio_decoder_opus.cc index 3d8fabf..27f01fd 100644 --- a/remoting/codec/audio_decoder_opus.cc +++ b/remoting/codec/audio_decoder_opus.cc @@ -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); diff --git a/remoting/codec/audio_decoder_verbatim.cc b/remoting/codec/audio_decoder_verbatim.cc index 6c9b639..a04e2a5 100644 --- a/remoting/codec/audio_decoder_verbatim.cc +++ b/remoting/codec/audio_decoder_verbatim.cc @@ -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(); } diff --git a/remoting/codec/audio_encoder_opus.cc b/remoting/codec/audio_encoder_opus.cc index 53bfe0b..b2a9b5e 100644 --- a/remoting/codec/audio_encoder_opus.cc +++ b/remoting/codec/audio_encoder_opus.cc @@ -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(); } diff --git a/remoting/codec/video_decoder_vpx.cc b/remoting/codec/video_decoder_vpx.cc index 0be9201..bae8c23 100644 --- a/remoting/codec/video_decoder_vpx.cc +++ b/remoting/codec/video_decoder_vpx.cc @@ -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())); diff --git a/remoting/host/audio_capturer_linux.cc b/remoting/host/audio_capturer_linux.cc index 7f111e3..1210397 100644 --- a/remoting/host/audio_capturer_linux.cc +++ b/remoting/host/audio_capturer_linux.cc @@ -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)); } diff --git a/remoting/host/audio_capturer_mac.cc b/remoting/host/audio_capturer_mac.cc index e328515..6ccf61f 100644 --- a/remoting/host/audio_capturer_mac.cc +++ b/remoting/host/audio_capturer_mac.cc @@ -13,7 +13,7 @@ bool AudioCapturer::IsSupported() { scoped_ptr<AudioCapturer> AudioCapturer::Create() { NOTIMPLEMENTED(); - return scoped_ptr<AudioCapturer>(); + return nullptr; } } // namespace remoting diff --git a/remoting/host/basic_desktop_environment.cc b/remoting/host/basic_desktop_environment.cc index f821d59..eb5e9bf 100644 --- a/remoting/host/basic_desktop_environment.cc +++ b/remoting/host/basic_desktop_environment.cc @@ -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> diff --git a/remoting/host/cast_extension.cc b/remoting/host/cast_extension.cc index 3a8f3b8..6b513f6 100644 --- a/remoting/host/cast_extension.cc +++ b/remoting/host/cast_extension.cc @@ -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 diff --git a/remoting/host/cast_extension_session.cc b/remoting/host/cast_extension_session.cc index bff8751..76baa85 100644 --- a/remoting/host/cast_extension_session.cc +++ b/remoting/host/cast_extension_session.cc @@ -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(); } diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc index 2177dca..86eee32 100644 --- a/remoting/host/chromoting_host_unittest.cc +++ b/remoting/host/chromoting_host_unittest.cc @@ -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(), diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc index feb581d..8d45b8f 100644 --- a/remoting/host/client_session.cc +++ b/remoting/host/client_session.cc @@ -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 diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc index b3dfa45..05e5a65 100644 --- a/remoting/host/client_session_unittest.cc +++ b/remoting/host/client_session_unittest.cc @@ -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, diff --git a/remoting/host/daemon_process_win.cc b/remoting/host/daemon_process_win.cc index b4cb9d1..e848d9e 100644 --- a/remoting/host/daemon_process_win.cc +++ b/remoting/host/daemon_process_win.cc @@ -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() { diff --git a/remoting/host/desktop_process_unittest.cc b/remoting/host/desktop_process_unittest.cc index 7a188a8..69acc3a 100644 --- a/remoting/host/desktop_process_unittest.cc +++ b/remoting/host/desktop_process_unittest.cc @@ -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(); diff --git a/remoting/host/desktop_session_agent.cc b/remoting/host/desktop_session_agent.cc index fd01bfd..32a50a8 100644 --- a/remoting/host/desktop_session_agent.cc +++ b/remoting/host/desktop_session_agent.cc @@ -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)); } diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc index a33fde5..7b7f57f 100644 --- a/remoting/host/desktop_session_proxy.cc +++ b/remoting/host/desktop_session_proxy.cc @@ -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); } } diff --git a/remoting/host/desktop_session_win.cc b/remoting/host/desktop_session_win.cc index 6005b30..b147783 100644 --- a/remoting/host/desktop_session_win.cc +++ b/remoting/host/desktop_session_win.cc @@ -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() { diff --git a/remoting/host/desktop_shape_tracker_mac.cc b/remoting/host/desktop_shape_tracker_mac.cc index 8ee02b3..1149ad0 100644 --- a/remoting/host/desktop_shape_tracker_mac.cc +++ b/remoting/host/desktop_shape_tracker_mac.cc @@ -11,7 +11,7 @@ namespace remoting { scoped_ptr<DesktopShapeTracker> DesktopShapeTracker::Create( webrtc::DesktopCaptureOptions options) { - return scoped_ptr<DesktopShapeTracker>(); + return nullptr; } } // namespace remoting diff --git a/remoting/host/desktop_shape_tracker_x11.cc b/remoting/host/desktop_shape_tracker_x11.cc index 8ee02b3..1149ad0 100644 --- a/remoting/host/desktop_shape_tracker_x11.cc +++ b/remoting/host/desktop_shape_tracker_x11.cc @@ -11,7 +11,7 @@ namespace remoting { scoped_ptr<DesktopShapeTracker> DesktopShapeTracker::Create( webrtc::DesktopCaptureOptions options) { - return scoped_ptr<DesktopShapeTracker>(); + return nullptr; } } // namespace remoting diff --git a/remoting/host/fake_desktop_environment.cc b/remoting/host/fake_desktop_environment.cc index f399ae8..bdf0d0a 100644 --- a/remoting/host/fake_desktop_environment.cc +++ b/remoting/host/fake_desktop_environment.cc @@ -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) {} diff --git a/remoting/host/gnubby_auth_handler_win.cc b/remoting/host/gnubby_auth_handler_win.cc index 12731b3..c512466 100644 --- a/remoting/host/gnubby_auth_handler_win.cc +++ b/remoting/host/gnubby_auth_handler_win.cc @@ -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 diff --git a/remoting/host/input_injector_linux.cc b/remoting/host/input_injector_linux.cc index 34e1d38..bcfb022 100644 --- a/remoting/host/input_injector_linux.cc +++ b/remoting/host/input_injector_linux.cc @@ -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 diff --git a/remoting/host/ipc_desktop_environment.cc b/remoting/host/ipc_desktop_environment.cc index de1f156..e8e2305 100644 --- a/remoting/host/ipc_desktop_environment.cc +++ b/remoting/host/ipc_desktop_environment.cc @@ -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( diff --git a/remoting/host/ipc_desktop_environment_unittest.cc b/remoting/host/ipc_desktop_environment_unittest.cc index 9e13e8f..eaa7cfe 100644 --- a/remoting/host/ipc_desktop_environment_unittest.cc +++ b/remoting/host/ipc_desktop_environment_unittest.cc @@ -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. diff --git a/remoting/host/it2me/it2me_native_messaging_host.cc b/remoting/host/it2me/it2me_native_messaging_host.cc index 6fb65df..eaede40 100644 --- a/remoting/host/it2me/it2me_native_messaging_host.cc +++ b/remoting/host/it2me/it2me_native_messaging_host.cc @@ -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. diff --git a/remoting/host/it2me/it2me_native_messaging_host_unittest.cc b/remoting/host/it2me/it2me_native_messaging_host_unittest.cc index 2e79b36..3d49b5c 100644 --- a/remoting/host/it2me/it2me_native_messaging_host_unittest.cc +++ b/remoting/host/it2me/it2me_native_messaging_host_unittest.cc @@ -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>( diff --git a/remoting/host/me2me_desktop_environment.cc b/remoting/host/me2me_desktop_environment.cc index e6f5fdc..de92383c 100644 --- a/remoting/host/me2me_desktop_environment.cc +++ b/remoting/host/me2me_desktop_environment.cc @@ -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) { diff --git a/remoting/host/pairing_registry_delegate_mac.cc b/remoting/host/pairing_registry_delegate_mac.cc index dba3ec3..ef3173a 100644 --- a/remoting/host/pairing_registry_delegate_mac.cc +++ b/remoting/host/pairing_registry_delegate_mac.cc @@ -11,7 +11,7 @@ namespace remoting { using protocol::PairingRegistry; scoped_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() { - return scoped_ptr<PairingRegistry::Delegate>(); + return nullptr; } } // namespace remoting diff --git a/remoting/host/pairing_registry_delegate_win.cc b/remoting/host/pairing_registry_delegate_win.cc index b4b89b2..ca814b2 100644 --- a/remoting/host/pairing_registry_delegate_win.cc +++ b/remoting/host/pairing_registry_delegate_win.cc @@ -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; } return scoped_ptr<base::DictionaryValue>( diff --git a/remoting/host/policy_hack/policy_watcher_linux.cc b/remoting/host/policy_hack/policy_watcher_linux.cc index 293155a..75a6541 100644 --- a/remoting/host/policy_hack/policy_watcher_linux.cc +++ b/remoting/host/policy_hack/policy_watcher_linux.cc @@ -149,12 +149,12 @@ class PolicyWatcherLinux : public PolicyWatcher { if (!value.get()) { LOG(WARNING) << "Failed to read configuration file " << config_file_iter->value() << ": " << error_msg; - return scoped_ptr<base::DictionaryValue>(); + return nullptr; } if (!value->IsType(base::Value::TYPE_DICTIONARY)) { LOG(WARNING) << "Expected JSON dictionary in configuration file " << config_file_iter->value(); - return scoped_ptr<base::DictionaryValue>(); + return nullptr; } policy->MergeDictionary(static_cast<base::DictionaryValue*>(value.get())); } diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index 0cb6175..837f848 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -800,7 +800,7 @@ void HostProcess::OnInitializePairingRegistry( if (!result) return; - pairing_registry_delegate_ = delegate.PassAs<PairingRegistry::Delegate>(); + pairing_registry_delegate_ = delegate.Pass(); #else // !defined(OS_WIN) NOTREACHED(); #endif // !defined(OS_WIN) @@ -1278,7 +1278,7 @@ void HostProcess::StartHost() { scoped_ptr<VideoFrameRecorderHostExtension> frame_recorder_extension( new VideoFrameRecorderHostExtension()); frame_recorder_extension->SetMaxContentBytes(frame_recorder_buffer_size_); - host_->AddExtension(frame_recorder_extension.PassAs<HostExtension>()); + host_->AddExtension(frame_recorder_extension.Pass()); } // TODO(simonmorris): Get the maximum session duration from a policy. diff --git a/remoting/host/resizing_host_observer_unittest.cc b/remoting/host/resizing_host_observer_unittest.cc index 93d3f48..fcba79f 100644 --- a/remoting/host/resizing_host_observer_unittest.cc +++ b/remoting/host/resizing_host_observer_unittest.cc @@ -108,7 +108,7 @@ class ResizingHostObserverTest : public testing::Test { desktop_resizer_ = desktop_resizer.get(); resizing_host_observer_.reset( - new ResizingHostObserver(desktop_resizer.PassAs<DesktopResizer>())); + new ResizingHostObserver(desktop_resizer.Pass())); resizing_host_observer_->SetNowFunctionForTesting( base::Bind(&ResizingHostObserverTest::GetTimeAndIncrement, base::Unretained(this))); diff --git a/remoting/host/session_manager_factory.cc b/remoting/host/session_manager_factory.cc index 080b7ce..ad6ac6bb 100644 --- a/remoting/host/session_manager_factory.cc +++ b/remoting/host/session_manager_factory.cc @@ -25,13 +25,11 @@ scoped_ptr<protocol::SessionManager> CreateHostSessionManager( scoped_ptr<protocol::TransportFactory> transport_factory( new protocol::LibjingleTransportFactory( - signal_strategy, - port_allocator.PassAs<cricket::HttpPortAllocatorBase>(), - network_settings)); + signal_strategy, port_allocator.Pass(), network_settings)); scoped_ptr<protocol::JingleSessionManager> session_manager( new protocol::JingleSessionManager(transport_factory.Pass())); - return session_manager.PassAs<protocol::SessionManager>(); + return session_manager.Pass(); } } // namespace remoting diff --git a/remoting/host/setup/daemon_controller_delegate_win.cc b/remoting/host/setup/daemon_controller_delegate_win.cc index 9ed446e..8379ea7 100644 --- a/remoting/host/setup/daemon_controller_delegate_win.cc +++ b/remoting/host/setup/daemon_controller_delegate_win.cc @@ -173,13 +173,13 @@ scoped_ptr<base::DictionaryValue> DaemonControllerDelegateWin::GetConfig() { // Configure and start the Daemon Controller if it is installed already. HRESULT hr = ActivateController(); if (FAILED(hr)) - return scoped_ptr<base::DictionaryValue>(); + return nullptr; // Get the host configuration. ScopedBstr host_config; hr = control_->GetConfig(host_config.Receive()); if (FAILED(hr)) - return scoped_ptr<base::DictionaryValue>(); + return nullptr; // Parse the string into a dictionary. base::string16 file_content( @@ -189,7 +189,7 @@ scoped_ptr<base::DictionaryValue> DaemonControllerDelegateWin::GetConfig() { base::JSON_ALLOW_TRAILING_COMMAS)); if (!config || config->GetType() != base::Value::TYPE_DICTIONARY) - return scoped_ptr<base::DictionaryValue>(); + return nullptr; return scoped_ptr<base::DictionaryValue>( static_cast<base::DictionaryValue*>(config.release())); diff --git a/remoting/host/setup/daemon_installer_win.cc b/remoting/host/setup/daemon_installer_win.cc index f54b6d7..decb9dc 100644 --- a/remoting/host/setup/daemon_installer_win.cc +++ b/remoting/host/setup/daemon_installer_win.cc @@ -382,7 +382,7 @@ scoped_ptr<DaemonInstallerWin> DaemonInstallerWin::Create( } else { // The user declined the UAC prompt or some other error occured. done.Run(result); - return scoped_ptr<DaemonInstallerWin>(); + return nullptr; } } diff --git a/remoting/host/setup/me2me_native_messaging_host.cc b/remoting/host/setup/me2me_native_messaging_host.cc index fc77b9f..bf3684fe 100644 --- a/remoting/host/setup/me2me_native_messaging_host.cc +++ b/remoting/host/setup/me2me_native_messaging_host.cc @@ -117,7 +117,7 @@ void Me2MeNativeMessagingHost::OnMessage(scoped_ptr<base::Value> message) { std::string type; if (!message_dict->GetString("type", &type)) { LOG(ERROR) << "'type' not found"; - channel_->SendMessage(scoped_ptr<base::Value>()); + channel_->SendMessage(nullptr); return; } @@ -174,7 +174,7 @@ void Me2MeNativeMessagingHost::ProcessHello( supported_features_list->AppendStrings(std::vector<std::string>( kSupportedFeatures, kSupportedFeatures + arraysize(kSupportedFeatures))); response->Set("supportedFeatures", supported_features_list.release()); - channel_->SendMessage(response.PassAs<base::Value>()); + channel_->SendMessage(response.Pass()); } void Me2MeNativeMessagingHost::ProcessClearPairedClients( @@ -232,7 +232,7 @@ void Me2MeNativeMessagingHost::ProcessGetHostName( DCHECK(thread_checker_.CalledOnValidThread()); response->SetString("hostname", net::GetHostName()); - channel_->SendMessage(response.PassAs<base::Value>()); + channel_->SendMessage(response.Pass()); } void Me2MeNativeMessagingHost::ProcessGetPinHash( @@ -253,7 +253,7 @@ void Me2MeNativeMessagingHost::ProcessGetPinHash( return; } response->SetString("hash", MakeHostPinHash(host_id, pin)); - channel_->SendMessage(response.PassAs<base::Value>()); + channel_->SendMessage(response.Pass()); } void Me2MeNativeMessagingHost::ProcessGenerateKeyPair( @@ -264,7 +264,7 @@ void Me2MeNativeMessagingHost::ProcessGenerateKeyPair( scoped_refptr<RsaKeyPair> key_pair = RsaKeyPair::Generate(); response->SetString("privateKey", key_pair->ToString()); response->SetString("publicKey", key_pair->GetPublicKey()); - channel_->SendMessage(response.PassAs<base::Value>()); + channel_->SendMessage(response.Pass()); } void Me2MeNativeMessagingHost::ProcessUpdateDaemonConfig( @@ -387,7 +387,7 @@ void Me2MeNativeMessagingHost::ProcessGetDaemonState( response->SetString("state", "UNKNOWN"); break; } - channel_->SendMessage(response.PassAs<base::Value>()); + channel_->SendMessage(response.Pass()); } void Me2MeNativeMessagingHost::ProcessGetHostClientId( @@ -397,7 +397,7 @@ void Me2MeNativeMessagingHost::ProcessGetHostClientId( response->SetString("clientId", google_apis::GetOAuth2ClientID( google_apis::CLIENT_REMOTING_HOST)); - channel_->SendMessage(response.PassAs<base::Value>()); + channel_->SendMessage(response.Pass()); } void Me2MeNativeMessagingHost::ProcessGetCredentialsFromAuthCode( @@ -434,7 +434,7 @@ void Me2MeNativeMessagingHost::SendConfigResponse( } else { response->Set("config", base::Value::CreateNullValue()); } - channel_->SendMessage(response.PassAs<base::Value>()); + channel_->SendMessage(response.Pass()); } void Me2MeNativeMessagingHost::SendPairedClientsResponse( @@ -443,7 +443,7 @@ void Me2MeNativeMessagingHost::SendPairedClientsResponse( DCHECK(thread_checker_.CalledOnValidThread()); response->Set("pairedClients", pairings.release()); - channel_->SendMessage(response.PassAs<base::Value>()); + channel_->SendMessage(response.Pass()); } void Me2MeNativeMessagingHost::SendUsageStatsConsentResponse( @@ -454,7 +454,7 @@ void Me2MeNativeMessagingHost::SendUsageStatsConsentResponse( response->SetBoolean("supported", consent.supported); response->SetBoolean("allowed", consent.allowed); response->SetBoolean("setByPolicy", consent.set_by_policy); - channel_->SendMessage(response.PassAs<base::Value>()); + channel_->SendMessage(response.Pass()); } void Me2MeNativeMessagingHost::SendAsyncResult( @@ -476,7 +476,7 @@ void Me2MeNativeMessagingHost::SendAsyncResult( response->SetString("result", "FAILED_DIRECTORY"); break; } - channel_->SendMessage(response.PassAs<base::Value>()); + channel_->SendMessage(response.Pass()); } void Me2MeNativeMessagingHost::SendBooleanResult( @@ -484,7 +484,7 @@ void Me2MeNativeMessagingHost::SendBooleanResult( DCHECK(thread_checker_.CalledOnValidThread()); response->SetBoolean("result", result); - channel_->SendMessage(response.PassAs<base::Value>()); + channel_->SendMessage(response.Pass()); } void Me2MeNativeMessagingHost::SendCredentialsResponse( @@ -495,12 +495,12 @@ void Me2MeNativeMessagingHost::SendCredentialsResponse( response->SetString("userEmail", user_email); response->SetString("refreshToken", refresh_token); - channel_->SendMessage(response.PassAs<base::Value>()); + channel_->SendMessage(response.Pass()); } void Me2MeNativeMessagingHost::OnError() { // Trigger a host shutdown by sending a NULL message. - channel_->SendMessage(scoped_ptr<base::Value>()); + channel_->SendMessage(nullptr); } void Me2MeNativeMessagingHost::Stop() { @@ -536,7 +536,7 @@ bool Me2MeNativeMessagingHost::DelegateToElevatedHost( // elevated_channel_ will be null if user rejects the UAC request. if (elevated_channel_) - elevated_channel_->SendMessage(message.PassAs<base::Value>()); + elevated_channel_->SendMessage(message.Pass()); return elevated_channel_ != NULL; } diff --git a/remoting/host/setup/me2me_native_messaging_host_main.cc b/remoting/host/setup/me2me_native_messaging_host_main.cc index a1b973c..6a97c71 100644 --- a/remoting/host/setup/me2me_native_messaging_host_main.cc +++ b/remoting/host/setup/me2me_native_messaging_host_main.cc @@ -232,9 +232,8 @@ int StartMe2MeNativeMessagingHost() { if (!delegate->SetRootKeys(privileged.Take(), unprivileged.Take())) return kInitializationFailed; - pairing_registry = new PairingRegistry( - io_thread.task_runner(), - delegate.PassAs<PairingRegistry::Delegate>()); + pairing_registry = + new PairingRegistry(io_thread.task_runner(), delegate.Pass()); #else // defined(OS_WIN) pairing_registry = CreatePairingRegistry(io_thread.task_runner()); diff --git a/remoting/host/setup/me2me_native_messaging_host_unittest.cc b/remoting/host/setup/me2me_native_messaging_host_unittest.cc index 467531c..35dcbac 100644 --- a/remoting/host/setup/me2me_native_messaging_host_unittest.cc +++ b/remoting/host/setup/me2me_native_messaging_host_unittest.cc @@ -328,12 +328,7 @@ void Me2MeNativeMessagingHostTest::StartHost() { output_write_file.Pass())); host_.reset(new Me2MeNativeMessagingHost( - false, - 0, - channel.Pass(), - daemon_controller, - pairing_registry, - scoped_ptr<remoting::OAuthClient>())); + false, 0, channel.Pass(), daemon_controller, pairing_registry, nullptr)); host_->Start(base::Bind(&Me2MeNativeMessagingHostTest::StopHost, base::Unretained(this))); @@ -389,19 +384,19 @@ Me2MeNativeMessagingHostTest::ReadMessageFromOutputPipe() { int read_result = output_read_file_.ReadAtCurrentPos( reinterpret_cast<char*>(&length), sizeof(length)); if (read_result != sizeof(length)) { - return scoped_ptr<base::DictionaryValue>(); + return nullptr; } std::string message_json(length, '\0'); read_result = output_read_file_.ReadAtCurrentPos( string_as_array(&message_json), length); if (read_result != static_cast<int>(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)) { - return scoped_ptr<base::DictionaryValue>(); + return nullptr; } return scoped_ptr<base::DictionaryValue>( diff --git a/remoting/host/single_window_desktop_environment.cc b/remoting/host/single_window_desktop_environment.cc index 7950b8a..acb2c01 100644 --- a/remoting/host/single_window_desktop_environment.cc +++ b/remoting/host/single_window_desktop_environment.cc @@ -51,7 +51,7 @@ SingleWindowDesktopEnvironment::CreateVideoCapturer() { webrtc::WindowCapturer::Create(options)); window_capturer->SelectWindow(window_id_); - return window_capturer.PassAs<webrtc::DesktopCapturer>(); + return window_capturer.Pass(); } scoped_ptr<InputInjector> @@ -62,7 +62,7 @@ SingleWindowDesktopEnvironment::CreateInputInjector() { InputInjector::Create(input_task_runner(), ui_task_runner())); return SingleWindowInputInjector::CreateForWindow( - window_id_, input_injector.Pass()).PassAs<InputInjector>(); + window_id_, input_injector.Pass()).Pass(); } SingleWindowDesktopEnvironment::SingleWindowDesktopEnvironment( @@ -100,7 +100,7 @@ scoped_ptr<DesktopEnvironment> SingleWindowDesktopEnvironmentFactory::Create( input_task_runner(), ui_task_runner(), window_id_)); - return desktop_environment.PassAs<DesktopEnvironment>(); + return desktop_environment.Pass(); } } // namespace remoting diff --git a/remoting/host/single_window_input_injector_linux.cc b/remoting/host/single_window_input_injector_linux.cc index fd42f66..7baa8bd 100644 --- a/remoting/host/single_window_input_injector_linux.cc +++ b/remoting/host/single_window_input_injector_linux.cc @@ -9,7 +9,7 @@ namespace remoting { scoped_ptr<InputInjector> SingleWindowInputInjector::CreateForWindow( webrtc::WindowId window_id, scoped_ptr<InputInjector> input_injector) { - return scoped_ptr<InputInjector>(); + return nullptr; } } // namespace remoting diff --git a/remoting/host/single_window_input_injector_mac.cc b/remoting/host/single_window_input_injector_mac.cc index 78dc2e2..ab0c095 100644 --- a/remoting/host/single_window_input_injector_mac.cc +++ b/remoting/host/single_window_input_injector_mac.cc @@ -160,7 +160,7 @@ scoped_ptr<InputInjector> SingleWindowInputInjector::CreateForWindow( scoped_ptr<InputInjector> input_injector) { scoped_ptr<SingleWindowInputInjectorMac> injector( new SingleWindowInputInjectorMac(window_id, input_injector.Pass())); - return injector.PassAs<InputInjector>(); + return injector.Pass(); } } // namespace remoting diff --git a/remoting/host/single_window_input_injector_win.cc b/remoting/host/single_window_input_injector_win.cc index fd42f66..7baa8bd 100644 --- a/remoting/host/single_window_input_injector_win.cc +++ b/remoting/host/single_window_input_injector_win.cc @@ -9,7 +9,7 @@ namespace remoting { scoped_ptr<InputInjector> SingleWindowInputInjector::CreateForWindow( webrtc::WindowId window_id, scoped_ptr<InputInjector> input_injector) { - return scoped_ptr<InputInjector>(); + return nullptr; } } // namespace remoting diff --git a/remoting/host/video_frame_recorder.cc b/remoting/host/video_frame_recorder.cc index 8883b10..4e3df47 100644 --- a/remoting/host/video_frame_recorder.cc +++ b/remoting/host/video_frame_recorder.cc @@ -139,7 +139,7 @@ scoped_ptr<VideoEncoder> VideoFrameRecorder::WrapVideoEncoder( weak_factory_.GetWeakPtr())); recording_encoder_ = recording_encoder->AsWeakPtr(); - return recording_encoder.PassAs<VideoEncoder>(); + return recording_encoder.Pass(); } void VideoFrameRecorder::DetachVideoEncoderWrapper() { diff --git a/remoting/host/video_scheduler_unittest.cc b/remoting/host/video_scheduler_unittest.cc index 1d76d58..d79aa43 100644 --- a/remoting/host/video_scheduler_unittest.cc +++ b/remoting/host/video_scheduler_unittest.cc @@ -317,9 +317,7 @@ TEST_F(VideoSchedulerTest, StartAndStop) { // Start video frame capture. scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor( new FakeMouseCursorMonitor()); - StartVideoScheduler(capturer.PassAs<webrtc::DesktopCapturer>(), - encoder.PassAs<VideoEncoder>(), - cursor_monitor.PassAs<webrtc::MouseCursorMonitor>()); + StartVideoScheduler(capturer.Pass(), encoder.Pass(), cursor_monitor.Pass()); // Run until there are no more pending tasks from the VideoScheduler. // Otherwise, a lingering frame capture might attempt to trigger a capturer diff --git a/remoting/host/win/session_desktop_environment.cc b/remoting/host/win/session_desktop_environment.cc index 82951ea..3336482 100644 --- a/remoting/host/win/session_desktop_environment.cc +++ b/remoting/host/win/session_desktop_environment.cc @@ -66,10 +66,10 @@ scoped_ptr<DesktopEnvironment> SessionDesktopEnvironmentFactory::Create( inject_sas_)); if (!desktop_environment->InitializeSecurity(client_session_control, curtain_enabled())) { - return scoped_ptr<DesktopEnvironment>(); + return nullptr; } - return desktop_environment.PassAs<DesktopEnvironment>(); + return desktop_environment.Pass(); } } // namespace remoting diff --git a/remoting/host/win/worker_process_launcher_unittest.cc b/remoting/host/win/worker_process_launcher_unittest.cc index 32c00c2..0c93a83 100644 --- a/remoting/host/win/worker_process_launcher_unittest.cc +++ b/remoting/host/win/worker_process_launcher_unittest.cc @@ -312,7 +312,7 @@ void WorkerProcessLauncherTest::CrashWorker() { void WorkerProcessLauncherTest::StartWorker() { launcher_.reset(new WorkerProcessLauncher( - launcher_delegate_.PassAs<WorkerProcessLauncher::Delegate>(), + launcher_delegate_.Pass(), &server_listener_)); launcher_->SetKillProcessTimeoutForTest(base::TimeDelta::FromMilliseconds(0)); diff --git a/remoting/protocol/audio_reader.cc b/remoting/protocol/audio_reader.cc index 72a0afd..6176409 100644 --- a/remoting/protocol/audio_reader.cc +++ b/remoting/protocol/audio_reader.cc @@ -25,7 +25,7 @@ AudioReader::~AudioReader() { // static scoped_ptr<AudioReader> AudioReader::Create(const SessionConfig& config) { if (!config.is_audio_enabled()) - return scoped_ptr<AudioReader>(); + return nullptr; // TODO(kxing): Support different session configurations. return scoped_ptr<AudioReader>(new AudioReader(AudioPacket::ENCODING_RAW)); } diff --git a/remoting/protocol/audio_writer.cc b/remoting/protocol/audio_writer.cc index 81664e6..33cabd4 100644 --- a/remoting/protocol/audio_writer.cc +++ b/remoting/protocol/audio_writer.cc @@ -36,7 +36,7 @@ void AudioWriter::ProcessAudioPacket(scoped_ptr<AudioPacket> packet, // static scoped_ptr<AudioWriter> AudioWriter::Create(const SessionConfig& config) { if (!config.is_audio_enabled()) - return scoped_ptr<AudioWriter>(); + return nullptr; // TODO(kxing): Support different session configurations. return scoped_ptr<AudioWriter>(new AudioWriter()); } diff --git a/remoting/protocol/authenticator_test_base.cc b/remoting/protocol/authenticator_test_base.cc index 3579750..84bca67 100644 --- a/remoting/protocol/authenticator_test_base.cc +++ b/remoting/protocol/authenticator_test_base.cc @@ -116,12 +116,12 @@ void AuthenticatorTestBase::RunChannelAuth(bool expected_fail) { client_fake_socket_->PairWith(host_fake_socket_.get()); client_auth_->SecureAndAuthenticate( - client_fake_socket_.PassAs<net::StreamSocket>(), + client_fake_socket_.Pass(), base::Bind(&AuthenticatorTestBase::OnClientConnected, base::Unretained(this))); host_auth_->SecureAndAuthenticate( - host_fake_socket_.PassAs<net::StreamSocket>(), + host_fake_socket_.Pass(), base::Bind(&AuthenticatorTestBase::OnHostConnected, base::Unretained(this))); diff --git a/remoting/protocol/channel_multiplexer.cc b/remoting/protocol/channel_multiplexer.cc index 5751440..c0c5f78 100644 --- a/remoting/protocol/channel_multiplexer.cc +++ b/remoting/protocol/channel_multiplexer.cc @@ -214,7 +214,7 @@ scoped_ptr<net::StreamSocket> ChannelMultiplexer::MuxChannel::CreateSocket() { DCHECK(!socket_); // Can't create more than one socket per channel. scoped_ptr<MuxSocket> result(new MuxSocket(this)); socket_ = result.get(); - return result.PassAs<net::StreamSocket>(); + return result.Pass(); } void ChannelMultiplexer::MuxChannel::OnIncomingPacket( @@ -378,7 +378,7 @@ void ChannelMultiplexer::CreateChannel(const std::string& name, callback.Run(GetOrCreateChannel(name)->CreateSocket()); } else if (!base_channel_.get() && !base_channel_factory_) { // Fail synchronously if we failed to create |base_channel_|. - callback.Run(scoped_ptr<net::StreamSocket>()); + callback.Run(nullptr); } else { // Still waiting for the |base_channel_|. pending_channels_.push_back(PendingChannel(name, callback)); diff --git a/remoting/protocol/content_description.cc b/remoting/protocol/content_description.cc index 3c04c4a..ef9dca1 100644 --- a/remoting/protocol/content_description.cc +++ b/remoting/protocol/content_description.cc @@ -214,7 +214,7 @@ scoped_ptr<ContentDescription> ContentDescription::ParseXml( const XmlElement* element) { if (element->Name() != QName(kChromotingXmlNamespace, kDescriptionTag)) { LOG(ERROR) << "Invalid description: " << element->Str(); - return scoped_ptr<ContentDescription>(); + return nullptr; } scoped_ptr<CandidateSessionConfig> config( CandidateSessionConfig::CreateEmpty()); @@ -226,7 +226,7 @@ scoped_ptr<ContentDescription> ContentDescription::ParseXml( config->mutable_video_configs()) || !ParseChannelConfigs(element, kAudioTag, true, true, config->mutable_audio_configs())) { - return scoped_ptr<ContentDescription>(); + return nullptr; } scoped_ptr<XmlElement> authenticator_message; diff --git a/remoting/protocol/fake_datagram_socket.cc b/remoting/protocol/fake_datagram_socket.cc index 5b3f0ad..daf6a4b 100644 --- a/remoting/protocol/fake_datagram_socket.cc +++ b/remoting/protocol/fake_datagram_socket.cc @@ -158,7 +158,7 @@ void FakeDatagramChannelFactory::NotifyChannelCreated( const std::string& name, const ChannelCreatedCallback& callback) { if (channels_.find(name) != channels_.end()) - callback.Run(owned_socket.PassAs<net::Socket>()); + callback.Run(owned_socket.Pass()); } void FakeDatagramChannelFactory::CancelChannelCreation( diff --git a/remoting/protocol/fake_stream_socket.cc b/remoting/protocol/fake_stream_socket.cc index 58f11a0..57ce4f6 100644 --- a/remoting/protocol/fake_stream_socket.cc +++ b/remoting/protocol/fake_stream_socket.cc @@ -266,7 +266,7 @@ void FakeStreamChannelFactory::NotifyChannelCreated( const std::string& name, const ChannelCreatedCallback& callback) { if (channels_.find(name) != channels_.end()) - callback.Run(owned_channel.PassAs<net::StreamSocket>()); + callback.Run(owned_channel.Pass()); } void FakeStreamChannelFactory::CancelChannelCreation(const std::string& name) { diff --git a/remoting/protocol/jingle_session_manager.cc b/remoting/protocol/jingle_session_manager.cc index c726447d..1adef6f 100644 --- a/remoting/protocol/jingle_session_manager.cc +++ b/remoting/protocol/jingle_session_manager.cc @@ -54,7 +54,7 @@ scoped_ptr<Session> JingleSessionManager::Connect( scoped_ptr<JingleSession> session(new JingleSession(this)); session->StartConnection(host_jid, authenticator.Pass(), config.Pass()); sessions_[session->session_id_] = session.get(); - return session.PassAs<Session>(); + return session.Pass(); } void JingleSessionManager::Close() { diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc index 2788137..f27b3f9 100644 --- a/remoting/protocol/jingle_session_unittest.cc +++ b/remoting/protocol/jingle_session_unittest.cc @@ -153,8 +153,7 @@ class JingleSessionTest : public testing::Test { scoped_ptr<TransportFactory> host_transport(new LibjingleTransportFactory( NULL, - ChromiumPortAllocator::Create(NULL, network_settings) - .PassAs<cricket::HttpPortAllocatorBase>(), + ChromiumPortAllocator::Create(NULL, network_settings).Pass(), network_settings)); host_server_.reset(new JingleSessionManager(host_transport.Pass())); host_server_->Init(host_signal_strategy_.get(), &host_server_listener_); @@ -168,8 +167,7 @@ class JingleSessionTest : public testing::Test { .Times(1); scoped_ptr<TransportFactory> client_transport(new LibjingleTransportFactory( NULL, - ChromiumPortAllocator::Create(NULL, network_settings) - .PassAs<cricket::HttpPortAllocatorBase>(), + ChromiumPortAllocator::Create(NULL, network_settings).Pass(), network_settings)); client_server_.reset( new JingleSessionManager(client_transport.Pass())); diff --git a/remoting/protocol/libjingle_transport_factory.cc b/remoting/protocol/libjingle_transport_factory.cc index 4044150..0fe0c10 100644 --- a/remoting/protocol/libjingle_transport_factory.cc +++ b/remoting/protocol/libjingle_transport_factory.cc @@ -194,7 +194,7 @@ void LibjingleTransport::NotifyConnected() { Transport::ConnectedCallback callback = callback_; callback_.Reset(); - callback.Run(socket.PassAs<net::Socket>()); + callback.Run(socket.Pass()); } void LibjingleTransport::AddRemoteCandidate( @@ -353,7 +353,7 @@ scoped_ptr<Transport> LibjingleTransportFactory::CreateTransport() { result->OnCanStart(); } - return result.PassAs<Transport>(); + return result.Pass(); } void LibjingleTransportFactory::EnsureFreshJingleInfo() { diff --git a/remoting/protocol/me2me_host_authenticator_factory.cc b/remoting/protocol/me2me_host_authenticator_factory.cc index b9cc99d..5d97de1 100644 --- a/remoting/protocol/me2me_host_authenticator_factory.cc +++ b/remoting/protocol/me2me_host_authenticator_factory.cc @@ -48,13 +48,13 @@ class RejectingAuthenticator : public Authenticator { virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE { NOTREACHED(); - return scoped_ptr<buzz::XmlElement>(); + return nullptr; } virtual scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const OVERRIDE { NOTREACHED(); - return scoped_ptr<ChannelAuthenticator>(); + return nullptr; } protected: diff --git a/remoting/protocol/negotiating_authenticator_unittest.cc b/remoting/protocol/negotiating_authenticator_unittest.cc index 82a763c..64afc0c 100644 --- a/remoting/protocol/negotiating_authenticator_unittest.cc +++ b/remoting/protocol/negotiating_authenticator_unittest.cc @@ -79,7 +79,7 @@ class NegotiatingAuthenticatorTest : public AuthenticatorTestBase { client_as_negotiating_authenticator_ = new NegotiatingClientAuthenticator( client_id, client_paired_secret, kTestHostId, fetch_secret_callback, - scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher>(), methods); + nullptr, methods); client_.reset(client_as_negotiating_authenticator_); } diff --git a/remoting/protocol/secure_channel_factory.cc b/remoting/protocol/secure_channel_factory.cc index df98378..0ed2a65 100644 --- a/remoting/protocol/secure_channel_factory.cc +++ b/remoting/protocol/secure_channel_factory.cc @@ -51,7 +51,7 @@ void SecureChannelFactory::OnBaseChannelCreated( const ChannelCreatedCallback& callback, scoped_ptr<net::StreamSocket> socket) { if (!socket) { - callback.Run(scoped_ptr<net::StreamSocket>()); + callback.Run(nullptr); return; } diff --git a/remoting/protocol/ssl_hmac_channel_authenticator.cc b/remoting/protocol/ssl_hmac_channel_authenticator.cc index f4bedea..575f215 100644 --- a/remoting/protocol/ssl_hmac_channel_authenticator.cc +++ b/remoting/protocol/ssl_hmac_channel_authenticator.cc @@ -280,12 +280,12 @@ void SslHmacChannelAuthenticator::CheckDone(bool* callback_called) { if (callback_called) *callback_called = true; - CallDoneCallback(net::OK, socket_.PassAs<net::StreamSocket>()); + CallDoneCallback(net::OK, socket_.Pass()); } } void SslHmacChannelAuthenticator::NotifyError(int error) { - CallDoneCallback(error, scoped_ptr<net::StreamSocket>()); + CallDoneCallback(error, nullptr); } void SslHmacChannelAuthenticator::CallDoneCallback( diff --git a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc index 37fee45..4749dc0 100644 --- a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc +++ b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc @@ -75,12 +75,12 @@ class SslHmacChannelAuthenticatorTest : public testing::Test { client_fake_socket_->PairWith(host_fake_socket_.get()); client_auth_->SecureAndAuthenticate( - client_fake_socket_.PassAs<net::StreamSocket>(), + client_fake_socket_.Pass(), base::Bind(&SslHmacChannelAuthenticatorTest::OnClientConnected, base::Unretained(this))); host_auth_->SecureAndAuthenticate( - host_fake_socket_.PassAs<net::StreamSocket>(), + host_fake_socket_.Pass(), base::Bind(&SslHmacChannelAuthenticatorTest::OnHostConnected, base::Unretained(this), std::string("ref argument value"))); diff --git a/remoting/signaling/iq_sender.cc b/remoting/signaling/iq_sender.cc index bb04303..c7af213 100644 --- a/remoting/signaling/iq_sender.cc +++ b/remoting/signaling/iq_sender.cc @@ -46,7 +46,7 @@ scoped_ptr<IqRequest> IqSender::SendIq(scoped_ptr<buzz::XmlElement> stanza, std::string id = signal_strategy_->GetNextId(); stanza->AddAttr(buzz::QN_ID, id); if (!signal_strategy_->SendStanza(stanza.Pass())) { - return scoped_ptr<IqRequest>(); + return nullptr; } DCHECK(requests_.find(id) == requests_.end()); scoped_ptr<IqRequest> request(new IqRequest(this, callback, addressee)); diff --git a/remoting/test/protocol_perftest.cc b/remoting/test/protocol_perftest.cc index 25c36c6..a9cd445 100644 --- a/remoting/test/protocol_perftest.cc +++ b/remoting/test/protocol_perftest.cc @@ -237,7 +237,7 @@ class ProtocolPerfTest scoped_ptr<protocol::TransportFactory> host_transport_factory( new protocol::LibjingleTransportFactory( host_signaling_.get(), - port_allocator.PassAs<cricket::HttpPortAllocatorBase>(), + port_allocator.Pass(), network_settings)); scoped_ptr<protocol::SessionManager> session_manager( @@ -308,7 +308,7 @@ class ProtocolPerfTest scoped_ptr<protocol::TransportFactory> client_transport_factory( new protocol::LibjingleTransportFactory( client_signaling_.get(), - port_allocator.PassAs<cricket::HttpPortAllocatorBase>(), + port_allocator.Pass(), network_settings)); std::vector<protocol::AuthenticationMethod> auth_methods; @@ -320,10 +320,10 @@ class ProtocolPerfTest std::string(), // client_pairing_secret std::string(), // authentication_tag base::Bind(&ProtocolPerfTest::FetchPin, base::Unretained(this)), - scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher>(), + nullptr, auth_methods)); - client_.reset(new ChromotingClient( - client_context_.get(), this, this, scoped_ptr<AudioPlayer>())); + client_.reset( + new ChromotingClient(client_context_.get(), this, this, nullptr)); client_->SetProtocolConfigForTests(protocol_config_->Clone()); client_->Start( client_signaling_.get(), client_authenticator.Pass(), |