Bug 1488701 - Remove misleading std::move's - r=froydnj

Doing std::move when returning/assigning a local or temporary object is
preventing the compiler from performing copy elision.

In the case of UniquePtr, it's easier to `return MakeUnique<T>(...)` instead of
the move verbose `UniquePtr<T> r(new T(...)); return r;`

Differential Revision: https://phabricator.services.mozilla.com/D5019

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gerald Squelart 2018-09-05 11:41:07 +00:00
Родитель edc15db338
Коммит 87eed890a4
3 изменённых файлов: 10 добавлений и 15 удалений

Просмотреть файл

@ -86,10 +86,8 @@ SharedSurface_ANGLEShareHandle::Create(GLContext* gl, EGLConfig config,
}
#endif
typedef SharedSurface_ANGLEShareHandle ptrT;
UniquePtr<ptrT> ret( new ptrT(gl, egl, size, hasAlpha, pbuffer, shareHandle,
keyedMutex) );
return std::move(ret);
return MakeUnique<SharedSurface_ANGLEShareHandle>(
gl, egl, size, hasAlpha, pbuffer, shareHandle, keyedMutex);
}
EGLDisplay
@ -347,9 +345,8 @@ SurfaceFactory_ANGLEShareHandle::Create(GLContext* gl, const SurfaceCaps& caps,
EGLConfig config = GLContextEGL::Cast(gl)->mConfig;
typedef SurfaceFactory_ANGLEShareHandle ptrT;
UniquePtr<ptrT> ret( new ptrT(gl, caps, allocator, flags, egl, config) );
return std::move(ret);
return MakeUnique<SurfaceFactory_ANGLEShareHandle>(
gl, caps, allocator, flags, egl, config);
}
SurfaceFactory_ANGLEShareHandle::SurfaceFactory_ANGLEShareHandle(GLContext* gl,

Просмотреть файл

@ -404,10 +404,9 @@ SharedSurface_D3D11Interop::Create(DXInterop2Device* interop,
////
typedef SharedSurface_D3D11Interop ptrT;
UniquePtr<ptrT> ret ( new ptrT(gl, size, hasAlpha, prodTex, interopFB, interopRB,
interop, lockHandle, texD3D, dxgiHandle) );
return std::move(ret);
return MakeUnique<SharedSurface_D3D11Interop>(
gl, size, hasAlpha, prodTex, interopFB, interopRB,
interop, lockHandle, texD3D, dxgiHandle);
}
SharedSurface_D3D11Interop::SharedSurface_D3D11Interop(GLContext* gl,
@ -514,9 +513,8 @@ SurfaceFactory_D3D11Interop::Create(GLContext* gl, const SurfaceCaps& caps,
return nullptr;
}
typedef SurfaceFactory_D3D11Interop ptrT;
UniquePtr<ptrT> ret(new ptrT(gl, caps, allocator, flags, interop));
return std::move(ret);
return MakeUnique<SurfaceFactory_D3D11Interop>(
gl, caps, allocator, flags, interop);
}
SurfaceFactory_D3D11Interop::SurfaceFactory_D3D11Interop(GLContext* gl,

Просмотреть файл

@ -34,7 +34,7 @@ PassthruProxy::PassthruProxy(ProxyStream::Environment* aEnv, REFIID aIidToWrap,
{
ProxyStream proxyStream(aIidToWrap, aObjToWrap, aEnv,
ProxyStreamFlags::ePreservable);
mPreservedStream = std::move(proxyStream.GetPreservedStream());
mPreservedStream = proxyStream.GetPreservedStream();
MOZ_ASSERT(mPreservedStream);
}