refactor: replace deprecated DISALLOW_COPY_AND_ASSIGN (#31633)

This commit is contained in:
Milan Burda 2021-11-03 12:41:45 +01:00 committed by GitHub
parent 2a2a1a834c
commit 65a980c673
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
231 changed files with 918 additions and 576 deletions

View file

@ -42,6 +42,10 @@ class Archive : public gin::Wrappable<Archive> {
const char* GetTypeName() override { return "Archive"; }
// disable copy
Archive(const Archive&) = delete;
Archive& operator=(const Archive&) = delete;
protected:
Archive(v8::Isolate* isolate, std::unique_ptr<asar::Archive> archive)
: archive_(std::move(archive)) {}
@ -123,8 +127,6 @@ class Archive : public gin::Wrappable<Archive> {
private:
std::unique_ptr<asar::Archive> archive_;
DISALLOW_COPY_AND_ASSIGN(Archive);
};
// static

View file

@ -23,6 +23,10 @@ namespace api {
class Clipboard {
public:
// disable copy
Clipboard(const Clipboard&) = delete;
Clipboard& operator=(const Clipboard&) = delete;
static ui::ClipboardBuffer GetClipboardBuffer(gin_helper::Arguments* args);
static std::vector<std::u16string> AvailableFormats(
gin_helper::Arguments* args);
@ -61,9 +65,6 @@ class Clipboard {
static void WriteBuffer(const std::string& format_string,
const v8::Local<v8::Value> buffer,
gin_helper::Arguments* args);
private:
DISALLOW_COPY_AND_ASSIGN(Clipboard);
};
} // namespace api

View file

@ -32,6 +32,10 @@ class KeyWeakMap : public gin_helper::Wrappable<KeyWeakMap<K>> {
.SetMethod("remove", &KeyWeakMap<K>::Remove);
}
// disable copy
KeyWeakMap(const KeyWeakMap&) = delete;
KeyWeakMap& operator=(const KeyWeakMap&) = delete;
protected:
explicit KeyWeakMap(v8::Isolate* isolate) {
gin_helper::Wrappable<KeyWeakMap<K>>::Init(isolate);
@ -53,8 +57,6 @@ class KeyWeakMap : public gin_helper::Wrappable<KeyWeakMap<K>> {
void Remove(const K& key) { key_weak_map_.Remove(key); }
electron::KeyWeakMap<K> key_weak_map_;
DISALLOW_COPY_AND_ASSIGN(KeyWeakMap);
};
} // namespace api

View file

@ -51,6 +51,10 @@ class NativeImage : public gin::Wrappable<NativeImage> {
#endif
~NativeImage() override;
// disable copy
NativeImage(const NativeImage&) = delete;
NativeImage& operator=(const NativeImage&) = delete;
static gin::Handle<NativeImage> CreateEmpty(v8::Isolate* isolate);
static gin::Handle<NativeImage> Create(v8::Isolate* isolate,
const gfx::Image& image);
@ -132,8 +136,6 @@ class NativeImage : public gin::Wrappable<NativeImage> {
gfx::Image image_;
v8::Isolate* isolate_;
DISALLOW_COPY_AND_ASSIGN(NativeImage);
};
} // namespace api

View file

@ -9,7 +9,6 @@
#include <memory>
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "base/process/process_metrics.h"
#include "shell/common/gin_helper/promise.h"
@ -36,6 +35,10 @@ class ElectronBindings {
explicit ElectronBindings(uv_loop_t* loop);
virtual ~ElectronBindings();
// disable copy
ElectronBindings(const ElectronBindings&) = delete;
ElectronBindings& operator=(const ElectronBindings&) = delete;
// Add process._linkedBinding function, which behaves like process.binding
// but load native code from Electron instead.
void BindTo(v8::Isolate* isolate, v8::Local<v8::Object> process);
@ -77,8 +80,6 @@ class ElectronBindings {
UvHandle<uv_async_t> call_next_tick_async_;
std::list<node::Environment*> pending_next_ticks_;
std::unique_ptr<base::ProcessMetrics> metrics_;
DISALLOW_COPY_AND_ASSIGN(ElectronBindings);
};
} // namespace electron

View file

@ -5,7 +5,6 @@
#ifndef SHELL_COMMON_API_OBJECT_LIFE_MONITOR_H_
#define SHELL_COMMON_API_OBJECT_LIFE_MONITOR_H_
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "v8/include/v8.h"
@ -16,6 +15,10 @@ class ObjectLifeMonitor {
ObjectLifeMonitor(v8::Isolate* isolate, v8::Local<v8::Object> target);
virtual ~ObjectLifeMonitor();
// disable copy
ObjectLifeMonitor(const ObjectLifeMonitor&) = delete;
ObjectLifeMonitor& operator=(const ObjectLifeMonitor&) = delete;
virtual void RunDestructor() = 0;
private:
@ -25,8 +28,6 @@ class ObjectLifeMonitor {
v8::Global<v8::Object> target_;
base::WeakPtrFactory<ObjectLifeMonitor> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ObjectLifeMonitor);
};
} // namespace electron