Bug 1618735 - Remove nsAutoPtr usage from dom/plugins. r=handyman

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Eric Rahm 2020-02-28 20:31:44 +00:00
Родитель 0bef0512b7
Коммит 487e572e35
8 изменённых файлов: 22 добавлений и 18 удалений

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

@ -8,7 +8,7 @@
#include "jsfriendapi.h"
#include "nsAutoPtr.h"
#include "mozilla/UniquePtr.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsJSNPRuntime.h"
#include "nsNPAPIPlugin.h"
@ -280,7 +280,7 @@ static void DelayedReleaseGCCallback(JSGCStatus status) {
if (JSGC_END == status) {
// Take ownership of sDelayedReleases and null it out now. The
// _releaseobject call below can reenter GC and double-free these objects.
nsAutoPtr<nsTArray<NPObject*>> delayedReleases(sDelayedReleases);
UniquePtr<nsTArray<NPObject*>> delayedReleases(sDelayedReleases);
sDelayedReleases = nullptr;
if (delayedReleases) {

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

@ -11,6 +11,7 @@
#include "PluginMessageUtils.h"
#include "npapi.h"
#include "base/timer.h"
#include "mozilla/UniquePtr.h"
namespace mozilla {
namespace plugins {
@ -31,7 +32,9 @@ class ChildTimer {
class IDComparator {
public:
bool Equals(ChildTimer* t, uint32_t id) const { return t->ID() == id; }
bool Equals(const UniquePtr<ChildTimer>& t, uint32_t id) const {
return t->ID() == id;
}
};
private:

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

@ -35,7 +35,7 @@ class FunctionBrokerChild : public PFunctionBrokerChild {
void ShutdownOnDispatchThread();
void Bind(Endpoint<PFunctionBrokerChild>&& aEndpoint);
nsAutoPtr<FunctionBrokerThread> mThread;
UniquePtr<FunctionBrokerThread> mThread;
// True if tasks on the FunctionBrokerThread have completed
bool mShutdownDone;

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

@ -56,7 +56,7 @@ class FunctionBrokerParent : public PFunctionBrokerParent {
static mozilla::SandboxPermissions sSandboxPermissions;
#endif // defined(XP_WIN) && defined(MOZ_SANDBOX)
nsAutoPtr<FunctionBrokerThread> mThread;
UniquePtr<FunctionBrokerThread> mThread;
Monitor mMonitor;
bool mShutdownDone;
};

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

@ -4029,7 +4029,7 @@ void PluginInstanceChild::Destroy() {
ClearAllSurfaces();
mDirectBitmaps.Clear();
mDeletingHash = new nsTHashtable<DeletingObjectEntry>;
mDeletingHash = MakeUnique<nsTHashtable<DeletingObjectEntry>>();
PluginScriptableObjectChild::NotifyOfInstanceShutdown(this);
InvalidateObjects(*mDeletingHash);

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

@ -24,7 +24,7 @@
#endif
#include "npfunctions.h"
#include "nsAutoPtr.h"
#include "mozilla/UniquePtr.h"
#include "nsTArray.h"
#include "ChildTimer.h"
#include "nsRect.h"
@ -387,14 +387,14 @@ class PluginInstanceChild : public PPluginInstanceChild {
#if defined(OS_WIN)
nsTArray<FlashThrottleMsg*> mPendingFlashThrottleMsgs;
#endif
nsTArray<nsAutoPtr<ChildTimer> > mTimers;
nsTArray<UniquePtr<ChildTimer> > mTimers;
/**
* During destruction we enumerate all remaining scriptable objects and
* invalidate/delete them. Enumeration can re-enter, so maintain a
* hash separate from PluginModuleChild.mObjectMap.
*/
nsAutoPtr<nsTHashtable<DeletingObjectEntry> > mDeletingHash;
UniquePtr<nsTHashtable<DeletingObjectEntry> > mDeletingHash;
#if defined(MOZ_WIDGET_COCOA)
private:

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

@ -26,7 +26,7 @@
#include "mozilla/Services.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Unused.h"
#include "nsAutoPtr.h"
#include "mozilla/UniquePtr.h"
#include "nsCRT.h"
#include "nsIFile.h"
#include "nsICrashService.h"
@ -351,7 +351,7 @@ void mozilla::plugins::TerminatePlugin(uint32_t aPluginId,
PluginLibrary* PluginModuleContentParent::LoadModule(uint32_t aPluginId,
nsPluginTag* aPluginTag) {
PluginModuleMapping::NotifyLoadingModule loadingModule;
nsAutoPtr<PluginModuleMapping> mapping(new PluginModuleMapping(aPluginId));
UniquePtr<PluginModuleMapping> mapping(new PluginModuleMapping(aPluginId));
MOZ_ASSERT(XRE_IsContentProcess());
@ -378,7 +378,7 @@ PluginLibrary* PluginModuleContentParent::LoadModule(uint32_t aPluginId,
// mapping is linked into PluginModuleMapping::sModuleListHead and is
// needed later, so since this function is returning successfully we
// forget it here.
mapping.forget();
Unused << mapping.release();
}
parent->mPluginId = aPluginId;
@ -390,7 +390,7 @@ PluginLibrary* PluginModuleContentParent::LoadModule(uint32_t aPluginId,
/* static */
void PluginModuleContentParent::Initialize(
Endpoint<PPluginModuleParent>&& aEndpoint) {
nsAutoPtr<PluginModuleMapping> moduleMapping(
UniquePtr<PluginModuleMapping> moduleMapping(
PluginModuleMapping::Resolve(aEndpoint.OtherPid()));
MOZ_ASSERT(moduleMapping);
PluginModuleContentParent* parent = moduleMapping->GetModule();
@ -414,7 +414,7 @@ void PluginModuleContentParent::Initialize(
// moduleMapping is linked into PluginModuleMapping::sModuleListHead and is
// needed later, so since this function is returning successfully we
// forget it here.
moduleMapping.forget();
Unused << moduleMapping.release();
}
// static
@ -423,9 +423,10 @@ PluginLibrary* PluginModuleChromeParent::LoadModule(const char* aFilePath,
nsPluginTag* aPluginTag) {
PLUGIN_LOG_DEBUG_FUNCTION;
nsAutoPtr<PluginModuleChromeParent> parent(new PluginModuleChromeParent(
UniquePtr<PluginModuleChromeParent> parent(new PluginModuleChromeParent(
aFilePath, aPluginId, aPluginTag->mSandboxLevel));
UniquePtr<LaunchCompleteTask> onLaunchedRunnable(new LaunchedTask(parent));
UniquePtr<LaunchCompleteTask> onLaunchedRunnable(
new LaunchedTask(parent.get()));
bool launched = parent->mSubprocess->Launch(
std::move(onLaunchedRunnable), aPluginTag->mSandboxLevel,
aPluginTag->mIsSandboxLoggingEnabled);
@ -461,7 +462,7 @@ PluginLibrary* PluginModuleChromeParent::LoadModule(const char* aFilePath,
Unused << parent->SendInitPluginFunctionBroker(std::move(brokerChildEnd));
}
#endif
return parent.forget();
return parent.release();
}
static const char* gCallbackPrefs[] = {

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

@ -10,7 +10,7 @@
#endif
#include "mozilla/plugins/PPluginWidgetParent.h"
#include "nsAutoPtr.h"
#include "mozilla/UniquePtr.h"
#include "nsIWidget.h"
#include "nsCOMPtr.h"