Bug 1453129 - don't needlessly copy data in nsClipboardProxy; r=smaug

We're already going to copy the data when we initialize the
nsISupportsString here.  There's no need to copy the data into a
temporary object before passing it in to the nsISupportsString.

And as long as we're fixing the big mistakes, we might as well fix the
small ones, like copying the flavor string from the IPC object.
This commit is contained in:
Nathan Froyd 2018-04-10 19:07:40 -04:00
Родитель fe6068a327
Коммит 14488e954b
1 изменённых файлов: 2 добавлений и 2 удалений

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

@ -81,7 +81,7 @@ nsClipboardProxy::GetData(nsITransferable *aTransferable, int32_t aWhichClipboar
do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsString data = item.data().get_nsString();
const nsString& data = item.data().get_nsString();
rv = dataWrapper->SetData(data);
NS_ENSURE_SUCCESS(rv, rv);
@ -90,7 +90,7 @@ nsClipboardProxy::GetData(nsITransferable *aTransferable, int32_t aWhichClipboar
NS_ENSURE_SUCCESS(rv, rv);
} else if (item.data().type() == IPCDataTransferData::TShmem) {
// If this is an image, convert it into an nsIInputStream.
nsCString flavor = item.flavor();
const nsCString& flavor = item.flavor();
mozilla::ipc::Shmem data = item.data().get_Shmem();
if (flavor.EqualsLiteral(kJPEGImageMime) ||
flavor.EqualsLiteral(kJPGImageMime) ||