Commit 68860bd0 authored by ricea's avatar ricea Committed by Commit bot

Re-write many calls to WrapUnique() with MakeUnique()

A mostly-automated change to convert instances of WrapUnique(new Foo(...)) to
MakeUnique<Foo>(...). See the thread at
https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/iQgMedVA8-k
for background.

To avoid requiring too many manual fixups, the change skips some cases that are
frequently problematic. In particular, in methods named Foo::Method() it will
not try to change WrapUnique(new Foo()) to MakeUnique<Foo>(). This is because
Foo::Method() may be accessing an internal constructor of Foo.

Cases where MakeUnique<NestedClass>(...) is called within a method of
OuterClass are common but hard to detect automatically, so have been fixed-up
manually.

The only types of manual fix ups applied are:
1) Revert MakeUnique back to WrapUnique
2) Change NULL to nullptr in argument list (MakeUnique cannot forward NULL
   correctly)
3) Add base:: namespace qualifier where missing.

WrapUnique(new Foo) has not been converted to MakeUnique<Foo>() as this might
change behaviour if Foo does not have a user-defined constructor. For example,
WrapUnique(new int) creates an unitialised integer, but MakeUnique<int>()
creates an integer initialised to 0.

git cl format has been been run over the CL. Spot-checking has uncovered no
cases of mis-formatting.

  BUG=637812

Review-Url: https://codereview.chromium.org/2253233004
Cr-Commit-Position: refs/heads/master@{#413390}
parent eb5cdbe2
......@@ -71,7 +71,7 @@ ChromiumUrlRequestFactory::~ChromiumUrlRequestFactory() {}
std::unique_ptr<UrlRequest> ChromiumUrlRequestFactory::CreateUrlRequest(
UrlRequest::Type type,
const std::string& url) {
return base::WrapUnique(new ChromiumUrlRequest(url_context_, type, url));
return base::MakeUnique<ChromiumUrlRequest>(url_context_, type, url);
}
} // namespace remoting
......@@ -247,10 +247,9 @@ void ChromotingClient::StartConnection() {
DCHECK(thread_checker_.CalledOnValidThread());
connection_->Connect(
session_manager_->Connect(
host_jid_,
base::WrapUnique(new protocol::NegotiatingClientAuthenticator(
NormalizeJid(signal_strategy_->GetLocalJid()), host_jid_,
client_auth_config_))),
host_jid_, base::MakeUnique<protocol::NegotiatingClientAuthenticator>(
NormalizeJid(signal_strategy_->GetLocalJid()),
host_jid_, client_auth_config_)),
transport_context_, this);
}
......
......@@ -58,9 +58,9 @@ std::unique_ptr<webrtc::DesktopFrame> DualBufferFrameConsumer::AllocateFrame(
// Both buffers are reallocated whenever screen size changes.
if (!buffers_[0] || !buffers_[0]->size().equals(size)) {
buffers_[0] = webrtc::SharedDesktopFrame::Wrap(
base::WrapUnique(new webrtc::BasicDesktopFrame(size)));
base::MakeUnique<webrtc::BasicDesktopFrame>(size));
buffers_[1] = webrtc::SharedDesktopFrame::Wrap(
base::WrapUnique(new webrtc::BasicDesktopFrame(size)));
base::MakeUnique<webrtc::BasicDesktopFrame>(size));
buffer_1_mask_.Clear();
current_buffer_ = 0;
} else {
......
......@@ -114,7 +114,7 @@ void GlDesktop::ReallocateTextures(const webrtc::DesktopSize& size) {
rect.IntersectWith(desktop_rect);
std::unique_ptr<GlDesktopTextureContainer> container =
base::WrapUnique(new GlDesktopTextureContainer{
base::WrapUnique(new GlRenderLayer(texture_id, canvas_)), rect});
base::MakeUnique<GlRenderLayer>(texture_id, canvas_), rect});
FillRectangleVertexPositions(rect.left(), rect.top(), rect.width(),
rect.height(), &positions);
container->layer->SetVertexPositions(positions);
......
......@@ -115,8 +115,7 @@ void GlRendererTest::RequestRender() {
void GlRendererTest::SetDesktopFrameWithSize(const webrtc::DesktopSize& size) {
renderer_->OnFrameReceived(
base::WrapUnique(
new webrtc::BasicDesktopFrame(size)),
base::MakeUnique<webrtc::BasicDesktopFrame>(size),
base::Bind(&GlRendererTest::OnDesktopFrameProcessed,
base::Unretained(this)));
}
......
......@@ -400,9 +400,9 @@ void ChromotingJniInstance::ConnectToHostOnNetworkThread() {
scoped_refptr<protocol::TransportContext> transport_context =
new protocol::TransportContext(
signaling_.get(),
base::WrapUnique(new protocol::ChromiumPortAllocatorFactory()),
base::WrapUnique(
new ChromiumUrlRequestFactory(jni_runtime_->url_requester())),
base::MakeUnique<protocol::ChromiumPortAllocatorFactory>(),
base::MakeUnique<ChromiumUrlRequestFactory>(
jni_runtime_->url_requester()),
protocol::NetworkSettings(
protocol::NetworkSettings::NAT_TRAVERSAL_FULL),
protocol::TransportRole::CLIENT);
......
......@@ -131,8 +131,7 @@ void ChromotingJniRuntime::StartLoggerOnNetworkThread() {
DCHECK(network_task_runner()->BelongsToCurrentThread());
logger_.reset(new ClientTelemetryLogger(ChromotingEvent::Mode::ME2ME));
logger_->Start(
base::WrapUnique(
new ChromiumUrlRequestFactory(runtime_->url_requester())),
base::MakeUnique<ChromiumUrlRequestFactory>(runtime_->url_requester()),
kTelemetryBaseUrl);
logger_->SetAuthClosure(
base::Bind(&ChromotingJniRuntime::FetchAuthToken,
......
......@@ -46,8 +46,8 @@ void JniGlDisplayHandler::InitializeClient(
std::unique_ptr<protocol::CursorShapeStub>
JniGlDisplayHandler::CreateCursorShapeStub() {
return base::WrapUnique(
new CursorShapeStubProxy(weak_ptr_, runtime_->display_task_runner()));
return base::MakeUnique<CursorShapeStubProxy>(
weak_ptr_, runtime_->display_task_runner());
}
std::unique_ptr<protocol::VideoRenderer>
......@@ -55,12 +55,12 @@ JniGlDisplayHandler::CreateVideoRenderer() {
DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread());
DCHECK(!frame_consumer_);
std::unique_ptr<DualBufferFrameConsumer> consumer =
base::WrapUnique(new DualBufferFrameConsumer(
base::MakeUnique<DualBufferFrameConsumer>(
base::Bind(&GlRenderer::OnFrameReceived, renderer_.GetWeakPtr()),
runtime_->display_task_runner(),
protocol::FrameConsumer::PixelFormat::FORMAT_RGBA));
protocol::FrameConsumer::PixelFormat::FORMAT_RGBA);
frame_consumer_ = consumer->GetWeakPtr();
return base::WrapUnique(new SoftwareVideoRenderer(std::move(consumer)));
return base::MakeUnique<SoftwareVideoRenderer>(std::move(consumer));
}
// static
......
......@@ -193,7 +193,7 @@ ChromotingInstance::ChromotingInstance(PP_Instance pp_instance)
rtc::InitRandom(random_seed, sizeof(random_seed));
// Send hello message.
PostLegacyJsonMessage("hello", base::WrapUnique(new base::DictionaryValue()));
PostLegacyJsonMessage("hello", base::MakeUnique<base::DictionaryValue>());
}
ChromotingInstance::~ChromotingInstance() {
......@@ -342,7 +342,7 @@ void ChromotingInstance::OnVideoDecodeError() {
void ChromotingInstance::OnVideoFirstFrameReceived() {
PostLegacyJsonMessage("onFirstFrameReceived",
base::WrapUnique(new base::DictionaryValue()));
base::MakeUnique<base::DictionaryValue>());
}
void ChromotingInstance::OnVideoFrameDirtyRegion(
......@@ -678,8 +678,8 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) {
scoped_refptr<protocol::TransportContext> transport_context(
new protocol::TransportContext(
signal_strategy_.get(),
base::WrapUnique(new PepperPortAllocatorFactory(this)),
base::WrapUnique(new PepperUrlRequestFactory(this)),
base::MakeUnique<PepperPortAllocatorFactory>(this),
base::MakeUnique<PepperUrlRequestFactory>(this),
protocol::NetworkSettings(
protocol::NetworkSettings::NAT_TRAVERSAL_FULL),
protocol::TransportRole::CLIENT));
......
......@@ -21,10 +21,10 @@ PepperPortAllocatorFactory::~PepperPortAllocatorFactory() {}
std::unique_ptr<cricket::PortAllocator>
PepperPortAllocatorFactory::CreatePortAllocator(
scoped_refptr<protocol::TransportContext> transport_context) {
return base::WrapUnique(new protocol::PortAllocator(
return base::MakeUnique<protocol::PortAllocator>(
base::WrapUnique(new PepperNetworkManager(pp_instance_)),
base::WrapUnique(new PepperPacketSocketFactory(pp_instance_)),
transport_context));
transport_context);
}
} // namespace remoting
......@@ -111,7 +111,7 @@ PepperUrlRequestFactory::~PepperUrlRequestFactory() {}
std::unique_ptr<UrlRequest> PepperUrlRequestFactory::CreateUrlRequest(
UrlRequest::Type type,
const std::string& url) {
return base::WrapUnique(new PepperUrlRequest(pp_instance_, type, url));
return base::MakeUnique<PepperUrlRequest>(pp_instance_, type, url);
}
} // namespace remoting
......@@ -52,7 +52,7 @@ class TestFrameConsumer : public protocol::FrameConsumer {
std::unique_ptr<DesktopFrame> AllocateFrame(
const webrtc::DesktopSize& size) override {
EXPECT_TRUE(thread_checker_.CalledOnValidThread());
return base::WrapUnique(new webrtc::BasicDesktopFrame(size));
return base::MakeUnique<webrtc::BasicDesktopFrame>(size);
}
void DrawFrame(std::unique_ptr<DesktopFrame> frame,
......
......@@ -51,8 +51,8 @@ BasicDesktopEnvironment::CreateScreenControls() {
std::unique_ptr<webrtc::MouseCursorMonitor>
BasicDesktopEnvironment::CreateMouseCursorMonitor() {
return base::WrapUnique(new MouseCursorMonitorProxy(
video_capture_task_runner_, *desktop_capture_options_));
return base::MakeUnique<MouseCursorMonitorProxy>(video_capture_task_runner_,
*desktop_capture_options_);
}
std::string BasicDesktopEnvironment::GetCapabilities() const {
......@@ -73,8 +73,8 @@ std::unique_ptr<webrtc::DesktopCapturer>
BasicDesktopEnvironment::CreateVideoCapturer() {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
return base::WrapUnique(new DesktopCapturerProxy(video_capture_task_runner_,
*desktop_capture_options_));
return base::MakeUnique<DesktopCapturerProxy>(video_capture_task_runner_,
*desktop_capture_options_);
}
BasicDesktopEnvironment::BasicDesktopEnvironment(
......
......@@ -48,9 +48,9 @@ std::unique_ptr<AudioEncoder> CreateAudioEncoder(
const protocol::ChannelConfig& audio_config = config.audio_config();
if (audio_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) {
return base::WrapUnique(new AudioEncoderVerbatim());
return base::MakeUnique<AudioEncoderVerbatim>();
} else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) {
return base::WrapUnique(new AudioEncoderOpus());
return base::MakeUnique<AudioEncoderOpus>();
}
NOTREACHED();
......@@ -189,7 +189,7 @@ void ClientSession::SetCapabilities(
}
// Compute the set of capabilities supported by both client and host.
client_capabilities_ = base::WrapUnique(new std::string());
client_capabilities_ = base::MakeUnique<std::string>();
if (capabilities.has_capabilities())
*client_capabilities_ = capabilities.capabilities();
capabilities_ = IntersectCapabilities(*client_capabilities_,
......@@ -450,9 +450,9 @@ ClientSessionControl* ClientSession::session_control() {
std::unique_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() {
DCHECK(CalledOnValidThread());
return base::WrapUnique(
new protocol::ClipboardThreadProxy(client_clipboard_factory_.GetWeakPtr(),
base::ThreadTaskRunnerHandle::Get()));
return base::MakeUnique<protocol::ClipboardThreadProxy>(
client_clipboard_factory_.GetWeakPtr(),
base::ThreadTaskRunnerHandle::Get());
}
void ClientSession::OnVideoSizeChanged(protocol::VideoStream* video_stream,
......
......@@ -32,7 +32,7 @@ class ContinueWindowAndroid : public ContinueWindow {
// static
std::unique_ptr<HostWindow> HostWindow::CreateContinueWindow() {
return base::WrapUnique(new ContinueWindowAndroid());
return base::MakeUnique<ContinueWindowAndroid>();
}
} // namespace remoting
......@@ -65,7 +65,7 @@ void ContinueWindowAura::HideUi() {
// static
std::unique_ptr<HostWindow> HostWindow::CreateContinueWindow() {
return base::WrapUnique(new ContinueWindowAura());
return base::MakeUnique<ContinueWindowAura>();
}
} // namespace remoting
......@@ -118,7 +118,7 @@ void ContinueWindowGtk::OnResponse(GtkDialog* dialog, int response_id) {
// static
std::unique_ptr<HostWindow> HostWindow::CreateContinueWindow() {
return base::WrapUnique(new ContinueWindowGtk());
return base::MakeUnique<ContinueWindowGtk>();
}
} // namespace remoting
......@@ -76,7 +76,7 @@ void ContinueWindowMac::HideUi() {
// static
std::unique_ptr<HostWindow> HostWindow::CreateContinueWindow() {
return base::WrapUnique(new ContinueWindowMac());
return base::MakeUnique<ContinueWindowMac>();
}
} // namespace remoting
......
......@@ -131,7 +131,7 @@ void ContinueWindowWin::EndDialog() {
// static
std::unique_ptr<HostWindow> HostWindow::CreateContinueWindow() {
return base::WrapUnique(new ContinueWindowWin());
return base::MakeUnique<ContinueWindowWin>();
}
} // namespace remoting
......@@ -119,11 +119,11 @@ class SharedMemoryFactoryImpl : public webrtc::SharedMemoryFactory {
std::unique_ptr<webrtc::SharedMemory> CreateSharedMemory(
size_t size) override {
base::Closure release_buffer_callback =
base::Bind(send_message_callback_,
base::Passed(base::WrapUnique(
new ChromotingDesktopNetworkMsg_ReleaseSharedBuffer(
next_shared_buffer_id_))));
base::Closure release_buffer_callback = base::Bind(
send_message_callback_,
base::Passed(
base::MakeUnique<ChromotingDesktopNetworkMsg_ReleaseSharedBuffer>(
next_shared_buffer_id_)));
std::unique_ptr<SharedMemoryImpl> buffer = SharedMemoryImpl::Create(
size, next_shared_buffer_id_, release_buffer_callback);
if (buffer) {
......@@ -138,9 +138,8 @@ class SharedMemoryFactoryImpl : public webrtc::SharedMemoryFactory {
next_shared_buffer_id_ += 2;
send_message_callback_.Run(
base::WrapUnique(new ChromotingDesktopNetworkMsg_CreateSharedBuffer(
buffer->id(), buffer->shared_memory()->handle(),
buffer->size())));
base::MakeUnique<ChromotingDesktopNetworkMsg_CreateSharedBuffer>(
buffer->id(), buffer->shared_memory()->handle(), buffer->size()));
}
return std::move(buffer);
......@@ -241,8 +240,8 @@ const std::string& DesktopSessionAgent::client_jid() const {
}
void DesktopSessionAgent::DisconnectSession(protocol::ErrorCode error) {
SendToNetwork(base::WrapUnique(
new ChromotingDesktopNetworkMsg_DisconnectSession(error)));
SendToNetwork(
base::MakeUnique<ChromotingDesktopNetworkMsg_DisconnectSession>(error));
}
void DesktopSessionAgent::OnLocalMouseMoved(
......@@ -342,8 +341,8 @@ void DesktopSessionAgent::OnCaptureResult(
last_frame_ = std::move(frame);
SendToNetwork(base::WrapUnique(
new ChromotingDesktopNetworkMsg_CaptureResult(result, serialized_frame)));
SendToNetwork(base::MakeUnique<ChromotingDesktopNetworkMsg_CaptureResult>(
result, serialized_frame));
}
void DesktopSessionAgent::OnMouseCursor(webrtc::MouseCursor* cursor) {
......@@ -351,8 +350,8 @@ void DesktopSessionAgent::OnMouseCursor(webrtc::MouseCursor* cursor) {
std::unique_ptr<webrtc::MouseCursor> owned_cursor(cursor);
SendToNetwork(base::WrapUnique(
new ChromotingDesktopNetworkMsg_MouseCursor(*owned_cursor)));
SendToNetwork(
base::MakeUnique<ChromotingDesktopNetworkMsg_MouseCursor>(*owned_cursor));
}
void DesktopSessionAgent::OnMouseCursorPosition(
......@@ -372,8 +371,9 @@ void DesktopSessionAgent::InjectClipboardEvent(
return;
}
SendToNetwork(base::WrapUnique(
new ChromotingDesktopNetworkMsg_InjectClipboardEvent(serialized_event)));
SendToNetwork(
base::MakeUnique<ChromotingDesktopNetworkMsg_InjectClipboardEvent>(
serialized_event));
}
void DesktopSessionAgent::ProcessAudioPacket(
......@@ -386,8 +386,8 @@ void DesktopSessionAgent::ProcessAudioPacket(
return;
}
SendToNetwork(base::WrapUnique(
new ChromotingDesktopNetworkMsg_AudioPacket(serialized_packet)));
SendToNetwork(base::MakeUnique<ChromotingDesktopNetworkMsg_AudioPacket>(
serialized_packet));
}
bool DesktopSessionAgent::Start(const base::WeakPtr<Delegate>& delegate,
......
......@@ -110,31 +110,31 @@ DesktopSessionProxy::DesktopSessionProxy(
std::unique_ptr<AudioCapturer> DesktopSessionProxy::CreateAudioCapturer() {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
return base::WrapUnique(new IpcAudioCapturer(this));
return base::MakeUnique<IpcAudioCapturer>(this);
}
std::unique_ptr<InputInjector> DesktopSessionProxy::CreateInputInjector() {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
return base::WrapUnique(new IpcInputInjector(this));
return base::MakeUnique<IpcInputInjector>(this);
}
std::unique_ptr<ScreenControls> DesktopSessionProxy::CreateScreenControls() {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
return base::WrapUnique(new IpcScreenControls(this));
return base::MakeUnique<IpcScreenControls>(this);
}
std::unique_ptr<webrtc::DesktopCapturer>
DesktopSessionProxy::CreateVideoCapturer() {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
return base::WrapUnique(new IpcVideoFrameCapturer(this));
return base::MakeUnique<IpcVideoFrameCapturer>(this);
}
std::unique_ptr<webrtc::MouseCursorMonitor>
DesktopSessionProxy::CreateMouseCursorMonitor() {
return base::WrapUnique(new IpcMouseCursorMonitor(this));
return base::MakeUnique<IpcMouseCursorMonitor>(this);
}
std::string DesktopSessionProxy::GetCapabilities() const {
......
......@@ -488,9 +488,9 @@ std::unique_ptr<DesktopSession> DesktopSessionWin::CreateForConsole(
DaemonProcess* daemon_process,
int id,
const ScreenResolution& resolution) {
return base::WrapUnique(new ConsoleSession(caller_task_runner, io_task_runner,
daemon_process, id,
HostService::GetInstance()));
return base::MakeUnique<ConsoleSession>(caller_task_runner, io_task_runner,
daemon_process, id,
HostService::GetInstance());
}
// static
......
......@@ -29,7 +29,7 @@ class DisconnectWindowAndroid : public HostWindow {
// static
std::unique_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
return base::WrapUnique(new DisconnectWindowAndroid());
return base::MakeUnique<DisconnectWindowAndroid>();
}
} // namespace remoting
......@@ -50,7 +50,7 @@ void DisconnectWindowAura::Start(
// static
std::unique_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
return base::WrapUnique(new DisconnectWindowAura());
return base::MakeUnique<DisconnectWindowAura>();
}
} // namespace remoting
......@@ -290,7 +290,7 @@ gboolean DisconnectWindowGtk::OnButtonPress(GtkWidget* widget,
// static
std::unique_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
return base::WrapUnique(new DisconnectWindowGtk());
return base::MakeUnique<DisconnectWindowGtk>();
}
} // namespace remoting
......@@ -76,7 +76,7 @@ void DisconnectWindowMac::Start(
// static
std::unique_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
return base::WrapUnique(new DisconnectWindowMac());
return base::MakeUnique<DisconnectWindowMac>();
}
} // namespace remoting
......
......@@ -397,7 +397,7 @@ bool DisconnectWindowWin::SetStrings() {
// static
std::unique_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
return base::WrapUnique(new DisconnectWindowWin());
return base::MakeUnique<DisconnectWindowWin>();
}
} // namespace remoting
......@@ -69,7 +69,7 @@ std::unique_ptr<InputInjector> FakeDesktopEnvironment::CreateInputInjector() {
}
std::unique_ptr<ScreenControls> FakeDesktopEnvironment::CreateScreenControls() {
return base::WrapUnique(new FakeScreenControls());
return base::MakeUnique<FakeScreenControls>();
}
std::unique_ptr<webrtc::DesktopCapturer>
......@@ -83,7 +83,7 @@ FakeDesktopEnvironment::CreateVideoCapturer() {
std::unique_ptr<webrtc::MouseCursorMonitor>
FakeDesktopEnvironment::CreateMouseCursorMonitor() {
return base::WrapUnique(new FakeMouseCursorMonitor());
return base::MakeUnique<FakeMouseCursorMonitor>();
}
std::string FakeDesktopEnvironment::GetCapabilities() const {
......
......@@ -62,7 +62,7 @@ std::unique_ptr<HostExtensionSession> FakeExtension::CreateExtensionSession(
protocol::ClientStub* client_stub) {
DCHECK(!was_instantiated());
was_instantiated_ = true;
return base::WrapUnique(new Session(this, message_type_));
return base::MakeUnique<Session>(this, message_type_);
}
} // namespace remoting
......@@ -94,10 +94,10 @@ std::unique_ptr<DesktopEnvironment> IpcDesktopEnvironmentFactory::Create(
base::WeakPtr<ClientSessionControl> client_session_control) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
return base::WrapUnique(new IpcDesktopEnvironment(
return base::MakeUnique<IpcDesktopEnvironment>(
audio_task_runner_, caller_task_runner_, io_task_runner_,
client_session_control, connector_factory_.GetWeakPtr(), curtain_enabled_,
supports_touch_events_));
supports_touch_events_);
}
void IpcDesktopEnvironmentFactory::SetEnableCurtaining(bool enable) {
......
......@@ -124,8 +124,9 @@ TEST_F(MouseCursorMonitorProxyTest, CursorShape) {
proxy_.reset(new MouseCursorMonitorProxy(
capture_thread_.task_runner(),
webrtc::DesktopCaptureOptions::CreateDefault()));
proxy_->SetMouseCursorMonitorForTests(base::WrapUnique(
new ThreadCheckMouseCursorMonitor(capture_thread_.task_runner())));
proxy_->SetMouseCursorMonitorForTests(
base::MakeUnique<ThreadCheckMouseCursorMonitor>(
capture_thread_.task_runner()));
proxy_->Init(this, webrtc::MouseCursorMonitor::SHAPE_ONLY);
proxy_->Capture();
......
......@@ -159,7 +159,7 @@ void PairingRegistryDelegateLinux::SetRegistryPathForTesting(
}
std::unique_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() {
return base::WrapUnique(new PairingRegistryDelegateLinux());
return base::MakeUnique<PairingRegistryDelegateLinux>();
}
} // namespace remoting
......@@ -266,7 +266,7 @@ bool PairingRegistryDelegateWin::Delete(const std::string& client_id) {
}
std::unique_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() {
return base::WrapUnique(new PairingRegistryDelegateWin());
return base::MakeUnique<PairingRegistryDelegateWin>();
}
} // namespace remoting
......@@ -173,7 +173,7 @@ PamAuthorizationFactory::CreateAuthenticator(const std::string& local_jid,
const std::string& remote_jid) {
std::unique_ptr<protocol::Authenticator> authenticator(
underlying_->CreateAuthenticator(local_jid, remote_jid));
return base::WrapUnique(new PamAuthorizer(std::move(authenticator)));
return base::MakeUnique<PamAuthorizer>(std::move(authenticator));
}
} // namespace remoting
......@@ -1436,9 +1436,9 @@ void HostProcess::StartHost() {
scoped_refptr<protocol::TransportContext> transport_context =
new protocol::TransportContext(
signal_strategy_.get(),
base::WrapUnique(new protocol::ChromiumPortAllocatorFactory()),
base::WrapUnique(new ChromiumUrlRequestFactory(
context_->url_request_context_getter())),
base::MakeUnique<protocol::ChromiumPortAllocatorFactory>(),
base::MakeUnique<ChromiumUrlRequestFactory>(
context_->url_request_context_getter()),
network_settings, protocol::TransportRole::SERVER);
transport_context->set_ice_config_url(
ServiceUrls::GetInstance()->ice_config_url());
......@@ -1461,8 +1461,8 @@ void HostProcess::StartHost() {
context_->video_encode_task_runner()));
if (security_key_auth_policy_enabled_ && security_key_extension_supported_) {
host_->AddExtension(base::WrapUnique(
new SecurityKeyExtension(context_->file_task_runner())));
host_->AddExtension(
base::MakeUnique<SecurityKeyExtension>(context_->file_task_runner()));
}
// TODO(simonmorris): Get the maximum session duration from a policy.
......
......@@ -43,9 +43,9 @@ std::unique_ptr<HostStarter> HostStarter::Create(
const std::string& chromoting_hosts_url,
net::URLRequestContextGetter* url_request_context_getter) {
return base::WrapUnique(new HostStarter(
base::WrapUnique(new gaia::GaiaOAuthClient(url_request_context_getter)),
base::WrapUnique(new remoting::ServiceClient(chromoting_hosts_url,
url_request_context_getter)),
base::MakeUnique<gaia::GaiaOAuthClient>(url_request_context_getter),
base::MakeUnique<remoting::ServiceClient>(chromoting_hosts_url,
url_request_context_getter),
remoting::DaemonController::Create()));
}
......
......@@ -198,7 +198,7 @@ DaemonController::State MockDaemonControllerDelegate::GetState() {
std::unique_ptr<base::DictionaryValue>
MockDaemonControllerDelegate::GetConfig() {
return base::WrapUnique(new base::DictionaryValue());
return base::MakeUnique<base::DictionaryValue>();
}
void MockDaemonControllerDelegate::SetConfigAndStart(
......
......@@ -141,9 +141,9 @@ TokenValidatorFactoryImpl::~TokenValidatorFactoryImpl() {
std::unique_ptr<protocol::TokenValidator>
TokenValidatorFactoryImpl::CreateTokenValidator(const std::string& local_jid,
const std::string& remote_jid) {
return base::WrapUnique(
new TokenValidatorImpl(third_party_auth_config_, key_pair_, local_jid,
remote_jid, request_context_getter_));
return base::MakeUnique<TokenValidatorImpl>(third_party_auth_config_,
key_pair_, local_jid, remote_jid,
request_context_getter_);
}
} // namespace remoting
......@@ -60,9 +60,9 @@ class SetResponseURLRequestContext: public net::TestURLRequestContext {
public:
void SetResponse(const std::string& headers, const std::string& response) {
std::unique_ptr<net::URLRequestJobFactoryImpl> factory =
base::WrapUnique(new net::URLRequestJobFactoryImpl());
base::MakeUnique<net::URLRequestJobFactoryImpl>();
factory->SetProtocolHandler(
"https", base::WrapUnique(new FakeProtocolHandler(headers, response)));
"https", base::MakeUnique<FakeProtocolHandler>(headers, response));
context_storage_.set_job_factory(std::move(factory));
}
};
......@@ -96,7 +96,7 @@ class TokenValidatorFactoryImplTest : public testing::Test {
key_pair_ = RsaKeyPair::FromString(kTestRsaKeyPair);
request_context_getter_ = new net::TestURLRequestContextGetter(
message_loop_.task_runner(),
base::WrapUnique(new SetResponseURLRequestContext()));
base::MakeUnique<SetResponseURLRequestContext>());
ThirdPartyAuthConfig config;
config.token_url = GURL(kTokenUrl);
config.token_validation_url = GURL(kTokenValidationUrl);
......
......@@ -23,10 +23,10 @@ std::unique_ptr<InputInjector>
SessionDesktopEnvironment::CreateInputInjector() {