refactor: replace deprecated DISALLOW_COPY_AND_ASSIGN (#31633)
This commit is contained in:
parent
2a2a1a834c
commit
65a980c673
231 changed files with 918 additions and 576 deletions
|
@ -96,8 +96,6 @@ class RefCountedGlobal
|
|||
|
||||
private:
|
||||
v8::Global<T> handle_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RefCountedGlobal);
|
||||
};
|
||||
|
||||
SafeV8Function::SafeV8Function(v8::Isolate* isolate, v8::Local<v8::Value> value)
|
||||
|
|
|
@ -71,6 +71,10 @@ class EventEmitter : public gin_helper::Wrappable<T> {
|
|||
return EmitWithEvent(name, event, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
// disable copy
|
||||
EventEmitter(const EventEmitter&) = delete;
|
||||
EventEmitter& operator=(const EventEmitter&) = delete;
|
||||
|
||||
protected:
|
||||
EventEmitter() {}
|
||||
|
||||
|
@ -93,8 +97,6 @@ class EventEmitter : public gin_helper::Wrappable<T> {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(EventEmitter);
|
||||
};
|
||||
|
||||
} // namespace gin_helper
|
||||
|
|
|
@ -52,6 +52,10 @@ class CallbackHolderBase {
|
|||
public:
|
||||
v8::Local<v8::External> GetHandle(v8::Isolate* isolate);
|
||||
|
||||
// disable copy
|
||||
CallbackHolderBase(const CallbackHolderBase&) = delete;
|
||||
CallbackHolderBase& operator=(const CallbackHolderBase&) = delete;
|
||||
|
||||
protected:
|
||||
explicit CallbackHolderBase(v8::Isolate* isolate);
|
||||
virtual ~CallbackHolderBase();
|
||||
|
@ -63,8 +67,6 @@ class CallbackHolderBase {
|
|||
const v8::WeakCallbackInfo<CallbackHolderBase>& data);
|
||||
|
||||
v8::Global<v8::External> v8_ref_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CallbackHolderBase);
|
||||
};
|
||||
|
||||
template <typename Sig>
|
||||
|
@ -79,8 +81,6 @@ class CallbackHolder : public CallbackHolderBase {
|
|||
|
||||
private:
|
||||
virtual ~CallbackHolder() = default;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CallbackHolder);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
namespace gin_helper {
|
||||
|
@ -18,6 +17,10 @@ class Locker {
|
|||
explicit Locker(v8::Isolate* isolate);
|
||||
~Locker();
|
||||
|
||||
// disable copy
|
||||
Locker(const Locker&) = delete;
|
||||
Locker& operator=(const Locker&) = delete;
|
||||
|
||||
// Returns whether current process is browser process, currently we detect it
|
||||
// by checking whether current has used V8 Lock, but it might be a bad idea.
|
||||
static inline bool IsBrowserProcess() { return v8::Locker::IsActive(); }
|
||||
|
@ -27,8 +30,6 @@ class Locker {
|
|||
void operator delete(void*, size_t);
|
||||
|
||||
std::unique_ptr<v8::Locker> locker_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Locker);
|
||||
};
|
||||
|
||||
} // namespace gin_helper
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
namespace gin_helper {
|
||||
|
@ -22,10 +21,12 @@ class MicrotasksScope {
|
|||
v8::MicrotasksScope::kRunMicrotasks);
|
||||
~MicrotasksScope();
|
||||
|
||||
// disable copy
|
||||
MicrotasksScope(const MicrotasksScope&) = delete;
|
||||
MicrotasksScope& operator=(const MicrotasksScope&) = delete;
|
||||
|
||||
private:
|
||||
std::unique_ptr<v8::MicrotasksScope> v8_microtasks_scope_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MicrotasksScope);
|
||||
};
|
||||
|
||||
} // namespace gin_helper
|
||||
|
|
|
@ -33,6 +33,10 @@ class PromiseBase {
|
|||
PromiseBase(v8::Isolate* isolate, v8::Local<v8::Promise::Resolver> handle);
|
||||
~PromiseBase();
|
||||
|
||||
// disable copy
|
||||
PromiseBase(const PromiseBase&) = delete;
|
||||
PromiseBase& operator=(const PromiseBase&) = delete;
|
||||
|
||||
// Support moving.
|
||||
PromiseBase(PromiseBase&&);
|
||||
PromiseBase& operator=(PromiseBase&&);
|
||||
|
@ -75,8 +79,6 @@ class PromiseBase {
|
|||
v8::Isolate* isolate_;
|
||||
v8::Global<v8::Context> context_;
|
||||
v8::Global<v8::Promise::Resolver> resolver_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(PromiseBase);
|
||||
};
|
||||
|
||||
// Template implementation that returns values.
|
||||
|
|
|
@ -25,8 +25,6 @@ class IDUserData : public base::SupportsUserData::Data {
|
|||
|
||||
private:
|
||||
int32_t id_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(IDUserData);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -24,6 +24,10 @@ class TrackableObjectBase : public CleanedUpAtExit {
|
|||
public:
|
||||
TrackableObjectBase();
|
||||
|
||||
// disable copy
|
||||
TrackableObjectBase(const TrackableObjectBase&) = delete;
|
||||
TrackableObjectBase& operator=(const TrackableObjectBase&) = delete;
|
||||
|
||||
// The ID in weak map.
|
||||
int32_t weak_map_id() const { return weak_map_id_; }
|
||||
|
||||
|
@ -45,8 +49,6 @@ class TrackableObjectBase : public CleanedUpAtExit {
|
|||
void Destroy();
|
||||
|
||||
base::WeakPtrFactory<TrackableObjectBase> weak_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(TrackableObjectBase);
|
||||
};
|
||||
|
||||
// All instances of TrackableObject will be kept in a weak map and can be got
|
||||
|
@ -125,8 +127,6 @@ class TrackableObject : public TrackableObjectBase, public EventEmitter<T> {
|
|||
private:
|
||||
static int32_t next_id_;
|
||||
static electron::KeyWeakMap<int32_t>* weak_map_; // leaked on purpose
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(TrackableObject);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -67,8 +67,6 @@ class Wrappable : public WrappableBase {
|
|||
|
||||
private:
|
||||
static gin::WrapperInfo kWrapperInfo;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Wrappable);
|
||||
};
|
||||
|
||||
// static
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue