зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1623181 - Remove nsAutoPtr usage from widget/gtk. r=stransky
Differential Revision: https://phabricator.services.mozilla.com/D67243 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
abc5a1f51d
Коммит
2ebdb299d2
|
@ -91,10 +91,10 @@ NS_IMPL_ISUPPORTS(nsClipboard, nsIClipboard, nsIObserver)
|
|||
|
||||
nsresult nsClipboard::Init(void) {
|
||||
if (gfxPlatformGtk::GetPlatform()->IsX11Display()) {
|
||||
mContext = new nsRetrievalContextX11();
|
||||
mContext = MakeUnique<nsRetrievalContextX11>();
|
||||
#if defined(MOZ_WAYLAND)
|
||||
} else {
|
||||
mContext = new nsRetrievalContextWayland();
|
||||
mContext = MakeUnique<nsRetrievalContextWayland>();
|
||||
#endif
|
||||
}
|
||||
NS_ASSERTION(mContext, "Missing nsRetrievalContext for nsClipboard!");
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#ifndef __nsClipboard_h_
|
||||
#define __nsClipboard_h_
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsIClipboard.h"
|
||||
#include "nsIObserver.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
@ -78,7 +79,7 @@ class nsClipboard : public nsIClipboard, public nsIObserver {
|
|||
nsCOMPtr<nsIClipboardOwner> mGlobalOwner;
|
||||
nsCOMPtr<nsITransferable> mSelectionTransferable;
|
||||
nsCOMPtr<nsITransferable> mGlobalTransferable;
|
||||
nsAutoPtr<nsRetrievalContext> mContext;
|
||||
mozilla::UniquePtr<nsRetrievalContext> mContext;
|
||||
};
|
||||
|
||||
extern const int kClipboardTimeout;
|
||||
|
|
|
@ -446,7 +446,7 @@ void nsRetrievalContextWayland::SetClipboardDataOffer(
|
|||
NS_ASSERTION(dataOffer, "We're missing stored clipboard data offer!");
|
||||
if (dataOffer) {
|
||||
g_hash_table_remove(mActiveOffers, aWaylandDataOffer);
|
||||
mClipboardOffer = dataOffer;
|
||||
mClipboardOffer = WrapUnique(dataOffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -464,7 +464,7 @@ void nsRetrievalContextWayland::SetPrimaryDataOffer(
|
|||
NS_ASSERTION(dataOffer, "We're missing primary data offer!");
|
||||
if (dataOffer) {
|
||||
g_hash_table_remove(mActiveOffers, aPrimaryDataOffer);
|
||||
mPrimaryOffer = dataOffer;
|
||||
mPrimaryOffer = WrapUnique(dataOffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -758,7 +758,7 @@ const char* nsRetrievalContextWayland::GetClipboardData(
|
|||
wayland_clipboard_contents_received,
|
||||
new FastTrackClipboard(mClipboardRequestNumber, this));
|
||||
} else {
|
||||
DataOffer* dataOffer =
|
||||
const auto& dataOffer =
|
||||
(selection == GDK_SELECTION_PRIMARY) ? mPrimaryOffer : mClipboardOffer;
|
||||
if (!dataOffer) {
|
||||
// Something went wrong. We're requested to provide clipboard data
|
||||
|
@ -781,7 +781,7 @@ const char* nsRetrievalContextWayland::GetClipboardText(
|
|||
LOGCLIP(("nsRetrievalContextWayland::GetClipboardText\n"));
|
||||
|
||||
GdkAtom selection = GetSelectionAtom(aWhichClipboard);
|
||||
DataOffer* dataOffer =
|
||||
const auto& dataOffer =
|
||||
(selection == GDK_SELECTION_PRIMARY) ? mPrimaryOffer : mClipboardOffer;
|
||||
if (!dataOffer) return nullptr;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <gdk/gdkwayland.h>
|
||||
#include <nsTArray.h>
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsClipboard.h"
|
||||
#include "nsWaylandDisplay.h"
|
||||
#include "mozwayland/mozwayland.h"
|
||||
|
@ -100,7 +101,7 @@ class nsWaylandDragContext : public nsISupports {
|
|||
private:
|
||||
virtual ~nsWaylandDragContext() = default;
|
||||
|
||||
nsAutoPtr<WaylandDataOffer> mDataOffer;
|
||||
mozilla::UniquePtr<WaylandDataOffer> mDataOffer;
|
||||
wl_display* mDisplay;
|
||||
uint32_t mTime;
|
||||
GtkWidget* mGtkWidget;
|
||||
|
@ -142,8 +143,8 @@ class nsRetrievalContextWayland : public nsRetrievalContext {
|
|||
|
||||
// Data offers provided by Wayland data device
|
||||
GHashTable* mActiveOffers;
|
||||
nsAutoPtr<DataOffer> mClipboardOffer;
|
||||
nsAutoPtr<DataOffer> mPrimaryOffer;
|
||||
mozilla::UniquePtr<DataOffer> mClipboardOffer;
|
||||
mozilla::UniquePtr<DataOffer> mPrimaryOffer;
|
||||
RefPtr<nsWaylandDragContext> mDragContext;
|
||||
|
||||
int mClipboardRequestNumber;
|
||||
|
|
Загрузка…
Ссылка в новой задаче