Open Bug 1856309 Opened 2 years ago Updated 2 years ago

copy-instead-of-move coverity warnings in RemoteTextureMap.cpp

Categories

(Core :: Graphics, task, P3)

task

Tracking

()

People

(Reporter: nical, Unassigned)

Details

(Keywords: coverity)

Found by coverity

* CID 1545151:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/gfx/layers/RemoteTextureMap.cpp: 257 in mozilla::layers::RemoteTextureMap::PushTexture(mozilla::layers::RemoteTextureId, mozilla::layers::RemoteTextureOwnerId, int, mozilla::UniquePtr<mozilla::layers::TextureData, mozilla::DefaultDelete<mozilla::layers::TextureData>> &&, RefPtr<mozilla::layers::TextureHost> &, mozilla::UniquePtr<mozilla::layers::SharedResourceWrapper, mozilla::DefaultDelete<mozilla::layers::SharedResourceWrapper>> &&)()


________________________________________________________________________________________________________
*** CID 1545151:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/gfx/layers/RemoteTextureMap.cpp: 257 in mozilla::layers::RemoteTextureMap::PushTexture(mozilla::layers::RemoteTextureId, mozilla::layers::RemoteTextureOwnerId, int, mozilla::UniquePtr<mozilla::layers::TextureData, mozilla::DefaultDelete<mozilla::layers::TextureData>> &&, RefPtr<mozilla::layers::TextureHost> &, mozilla::UniquePtr<mozilla::layers::SharedResourceWrapper, mozilla::DefaultDelete<mozilla::layers::SharedResourceWrapper>> &&)()
251         auto it = mRemoteTexturePushListeners.find(key);
252         // Notify a new texture if callback is requested
253         if (it != mRemoteTexturePushListeners.end()) {
254           RefPtr<CompositableHost> compositableHost = it->second;
255           RefPtr<Runnable> runnable = NS_NewRunnableFunction(
256               "RemoteTextureMap::PushTexture::Runnable",
>>>     CID 1545151:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
>>>     "compositableHost" is copied in call to copy constructor "RefPtr<mozilla::layers::CompositableHost>", when it could be moved instead.
257               [compositableHost, aTextureId, aOwnerId, aForPid]() {
258                 compositableHost->NotifyPushTexture(aTextureId, aOwnerId, aForPid);
259               });
260           CompositorThread()->Dispatch(runnable.forget());
261         }
262     

** CID 1545150:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/gfx/layers/RemoteTextureMap.cpp: 1155 in mozilla::layers::RemoteTextureMap::TextureDataHolder::TextureDataHolder(mozilla::layers::RemoteTextureId, RefPtr<mozilla::layers::TextureHost>, mozilla::UniquePtr<mozilla::layers::TextureData, mozilla::DefaultDelete<mozilla::layers::TextureData>> &&, mozilla::UniquePtr<mozilla::layers::SharedResourceWrapper, mozilla::DefaultDelete<mozilla::layers::SharedResourceWrapper>> &&)()


________________________________________________________________________________________________________
*** CID 1545150:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/gfx/layers/RemoteTextureMap.cpp: 1155 in mozilla::layers::RemoteTextureMap::TextureDataHolder::TextureDataHolder(mozilla::layers::RemoteTextureId, RefPtr<mozilla::layers::TextureHost>, mozilla::UniquePtr<mozilla::layers::TextureData, mozilla::DefaultDelete<mozilla::layers::TextureData>> &&, mozilla::UniquePtr<mozilla::layers::SharedResourceWrapper, mozilla::DefaultDelete<mozilla::layers::SharedResourceWrapper>> &&)()
1149     
1150     RemoteTextureMap::TextureDataHolder::TextureDataHolder(
1151         const RemoteTextureId aTextureId, RefPtr<TextureHost> aTextureHost,
1152         UniquePtr<TextureData>&& aTextureData,
1153         UniquePtr<SharedResourceWrapper>&& aResourceWrapper)
1154         : mTextureId(aTextureId),
>>>     CID 1545150:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
>>>     "aTextureHost" is copied in call to copy constructor "RefPtr<mozilla::layers::TextureHost>", when it could be moved instead.
1155           mTextureHost(aTextureHost),
1156           mTextureData(std::move(aTextureData)),
1157           mResourceWrapper(std::move(aResourceWrapper)) {}
1158     
1159     RemoteTextureMap::RenderingReadyCallbackHolder::RenderingReadyCallbackHolder(
1160         const RemoteTextureId aTextureId,
Keywords: coverity

cc sotaro since you wrote most of this code. There is no rush to fix this although I suppose it's a pretty low hanging fruit.

You need to log in before you can comment on or make changes to this bug.