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

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

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

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

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