[gin] Replace DISALLOW_* macros
Replace the deprecated macros with explicit deletions.
Also replace once instance in //extensions/ due to a IWYU issue.
Bug: 1010217
Change-Id: I20d8b30dc5966b0cc7bda1fc27925469aeef03f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2829945
Commit-Queue: Jochen Eisinger <[email protected]>
Auto-Submit: Daniel Hosseinian <[email protected]>
Reviewed-by: Jochen Eisinger <[email protected]>
Cr-Commit-Position: refs/heads/master@{#873232}
diff --git a/extensions/renderer/bindings/declarative_event.h b/extensions/renderer/bindings/declarative_event.h
index 0a4e8388..048e1ca9 100644
--- a/extensions/renderer/bindings/declarative_event.h
+++ b/extensions/renderer/bindings/declarative_event.h
@@ -29,6 +29,8 @@
const std::vector<std::string>& actions_list,
const std::vector<std::string>& conditions_list,
int webview_instance_id);
+ DeclarativeEvent(const DeclarativeEvent&) = delete;
+ DeclarativeEvent& operator=(const DeclarativeEvent&) = delete;
~DeclarativeEvent() override;
static gin::WrapperInfo kWrapperInfo;
@@ -55,8 +57,6 @@
APIRequestHandler* request_handler_;
const int webview_instance_id_;
-
- DISALLOW_COPY_AND_ASSIGN(DeclarativeEvent);
};
} // namespace extensions
diff --git a/gin/array_buffer.h b/gin/array_buffer.h
index 086371af..aef4331 100644
--- a/gin/array_buffer.h
+++ b/gin/array_buffer.h
@@ -9,7 +9,6 @@
#include <stdint.h>
#include "base/compiler_specific.h"
-#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "gin/converter.h"
#include "gin/gin_export.h"
@@ -30,6 +29,7 @@
public:
ArrayBuffer();
ArrayBuffer(v8::Isolate* isolate, v8::Local<v8::ArrayBuffer> buffer);
+ ArrayBuffer(const ArrayBuffer&) = delete;
~ArrayBuffer();
ArrayBuffer& operator=(const ArrayBuffer& other);
@@ -42,7 +42,6 @@
private:
std::shared_ptr<v8::BackingStore> backing_store_;
- DISALLOW_COPY(ArrayBuffer);
};
template<>
@@ -55,6 +54,7 @@
public:
ArrayBufferView();
ArrayBufferView(v8::Isolate* isolate, v8::Local<v8::ArrayBufferView> view);
+ ArrayBufferView(const ArrayBufferView&) = delete;
~ArrayBufferView();
ArrayBufferView& operator=(const ArrayBufferView& other);
@@ -67,8 +67,6 @@
ArrayBuffer array_buffer_;
size_t offset_;
size_t num_bytes_;
-
- DISALLOW_COPY(ArrayBufferView);
};
template<>
diff --git a/gin/data_object_builder.h b/gin/data_object_builder.h
index a85ff584..3f384b04 100644
--- a/gin/data_object_builder.h
+++ b/gin/data_object_builder.h
@@ -8,7 +8,6 @@
#include <utility>
#include "base/check.h"
-#include "base/macros.h"
#include "base/strings/string_piece.h"
#include "gin/converter.h"
#include "gin/gin_export.h"
@@ -38,6 +37,8 @@
class GIN_EXPORT DataObjectBuilder {
public:
explicit DataObjectBuilder(v8::Isolate* isolate);
+ DataObjectBuilder(const DataObjectBuilder&) = delete;
+ DataObjectBuilder& operator=(const DataObjectBuilder&) = delete;
template <typename T>
DataObjectBuilder& Set(base::StringPiece key, T&& value) {
@@ -69,8 +70,6 @@
v8::Isolate* isolate_;
v8::Local<v8::Context> context_;
v8::Local<v8::Object> object_;
-
- DISALLOW_COPY_AND_ASSIGN(DataObjectBuilder);
};
} // namespace gin
diff --git a/gin/function_template.h b/gin/function_template.h
index 2c13d41..62dd4f3a 100644
--- a/gin/function_template.h
+++ b/gin/function_template.h
@@ -10,7 +10,6 @@
#include "base/callback.h"
#include "base/check.h"
-#include "base/macros.h"
#include "base/strings/strcat.h"
#include "gin/arguments.h"
#include "gin/converter.h"
@@ -47,6 +46,9 @@
// among every CallbackHolder instance.
class GIN_EXPORT CallbackHolderBase {
public:
+ CallbackHolderBase(const CallbackHolderBase&) = delete;
+ CallbackHolderBase& operator=(const CallbackHolderBase&) = delete;
+
v8::Local<v8::External> GetHandle(v8::Isolate* isolate);
protected:
@@ -60,8 +62,6 @@
const v8::WeakCallbackInfo<CallbackHolderBase>& data);
v8::Global<v8::External> v8_ref_;
-
- DISALLOW_COPY_AND_ASSIGN(CallbackHolderBase);
};
template<typename Sig>
@@ -73,14 +73,14 @@
: CallbackHolderBase(isolate),
callback(std::move(callback)),
invoker_options(std::move(invoker_options)) {}
+ CallbackHolder(const CallbackHolder&) = delete;
+ CallbackHolder& operator=(const CallbackHolder&) = delete;
base::RepeatingCallback<Sig> callback;
InvokerOptions invoker_options;
private:
- ~CallbackHolder() override {}
-
- DISALLOW_COPY_AND_ASSIGN(CallbackHolder);
+ ~CallbackHolder() override = default;
};
template <typename T>
diff --git a/gin/interceptor.h b/gin/interceptor.h
index bd265fb..2d14ccee 100644
--- a/gin/interceptor.h
+++ b/gin/interceptor.h
@@ -10,7 +10,6 @@
#include <string>
#include <vector>
-#include "base/macros.h"
#include "gin/gin_export.h"
#include "v8/include/v8.h"
@@ -23,6 +22,8 @@
class GIN_EXPORT NamedPropertyInterceptor {
public:
NamedPropertyInterceptor(v8::Isolate* isolate, WrappableBase* base);
+ NamedPropertyInterceptor(const NamedPropertyInterceptor&) = delete;
+ NamedPropertyInterceptor& operator=(const NamedPropertyInterceptor&) = delete;
virtual ~NamedPropertyInterceptor();
virtual v8::Local<v8::Value> GetNamedProperty(v8::Isolate* isolate,
@@ -37,13 +38,14 @@
private:
v8::Isolate* isolate_;
WrappableBase* base_;
-
- DISALLOW_COPY_AND_ASSIGN(NamedPropertyInterceptor);
};
class GIN_EXPORT IndexedPropertyInterceptor {
public:
IndexedPropertyInterceptor(v8::Isolate* isolate, WrappableBase* base);
+ IndexedPropertyInterceptor(const IndexedPropertyInterceptor&) = delete;
+ IndexedPropertyInterceptor& operator=(const IndexedPropertyInterceptor&) =
+ delete;
virtual ~IndexedPropertyInterceptor();
virtual v8::Local<v8::Value> GetIndexedProperty(v8::Isolate* isolate,
@@ -58,8 +60,6 @@
private:
v8::Isolate* isolate_;
WrappableBase* base_;
-
- DISALLOW_COPY_AND_ASSIGN(IndexedPropertyInterceptor);
};
} // namespace gin
diff --git a/gin/interceptor_unittest.cc b/gin/interceptor_unittest.cc
index 79eb223..03b0505b 100644
--- a/gin/interceptor_unittest.cc
+++ b/gin/interceptor_unittest.cc
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "gin/interceptor.h"
+
#include <stdint.h>
#include "base/bind.h"
-#include "base/macros.h"
#include "gin/arguments.h"
#include "gin/handle.h"
-#include "gin/interceptor.h"
#include "gin/object_template_builder.h"
#include "gin/per_isolate_data.h"
#include "gin/public/isolate_holder.h"
@@ -24,6 +24,9 @@
public NamedPropertyInterceptor,
public IndexedPropertyInterceptor {
public:
+ MyInterceptor(const MyInterceptor&) = delete;
+ MyInterceptor& operator=(const MyInterceptor&) = delete;
+
static WrapperInfo kWrapperInfo;
static gin::Handle<MyInterceptor> Create(v8::Isolate* isolate) {
@@ -126,8 +129,6 @@
int value_;
v8::StdGlobalValueMap<std::string, v8::FunctionTemplate> template_cache_;
-
- DISALLOW_COPY_AND_ASSIGN(MyInterceptor);
};
WrapperInfo MyInterceptor::kWrapperInfo = {kEmbedderNativeGin};
diff --git a/gin/per_context_data.h b/gin/per_context_data.h
index 3931429..69a8806 100644
--- a/gin/per_context_data.h
+++ b/gin/per_context_data.h
@@ -5,7 +5,6 @@
#ifndef GIN_PER_CONTEXT_DATA_H_
#define GIN_PER_CONTEXT_DATA_H_
-#include "base/macros.h"
#include "base/supports_user_data.h"
#include "gin/gin_export.h"
#include "v8/include/v8.h"
@@ -24,6 +23,8 @@
public:
PerContextData(ContextHolder* context_holder,
v8::Local<v8::Context> context);
+ PerContextData(const PerContextData&) = delete;
+ PerContextData& operator=(const PerContextData&) = delete;
~PerContextData() override;
// Can return NULL after the ContextHolder has detached from context.
@@ -39,8 +40,6 @@
private:
ContextHolder* context_holder_;
Runner* runner_;
-
- DISALLOW_COPY_AND_ASSIGN(PerContextData);
};
} // namespace gin
diff --git a/gin/per_isolate_data.h b/gin/per_isolate_data.h
index 148a956..a3324402 100644
--- a/gin/per_isolate_data.h
+++ b/gin/per_isolate_data.h
@@ -8,7 +8,6 @@
#include <map>
#include <memory>
-#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/single_thread_task_runner.h"
#include "gin/gin_export.h"
@@ -32,6 +31,8 @@
v8::ArrayBuffer::Allocator* allocator,
IsolateHolder::AccessMode access_mode,
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+ PerIsolateData(const PerIsolateData&) = delete;
+ PerIsolateData& operator=(const PerIsolateData&) = delete;
~PerIsolateData();
static PerIsolateData* From(v8::Isolate* isolate);
@@ -92,8 +93,6 @@
IndexedPropertyInterceptorMap indexed_interceptors_;
NamedPropertyInterceptorMap named_interceptors_;
std::shared_ptr<V8ForegroundTaskRunnerBase> task_runner_;
-
- DISALLOW_COPY_AND_ASSIGN(PerIsolateData);
};
} // namespace gin
diff --git a/gin/public/context_holder.h b/gin/public/context_holder.h
index f0efc9b6..9f2d4dc 100644
--- a/gin/public/context_holder.h
+++ b/gin/public/context_holder.h
@@ -8,7 +8,6 @@
#include <list>
#include <memory>
-#include "base/macros.h"
#include "gin/gin_export.h"
#include "v8/include/v8.h"
@@ -29,6 +28,8 @@
class GIN_EXPORT ContextHolder {
public:
explicit ContextHolder(v8::Isolate* isolate);
+ ContextHolder(const ContextHolder&) = delete;
+ ContextHolder& operator=(const ContextHolder&) = delete;
~ContextHolder();
v8::Isolate* isolate() const { return isolate_; }
@@ -43,8 +44,6 @@
v8::Isolate* isolate_;
v8::UniquePersistent<v8::Context> context_;
std::unique_ptr<PerContextData> data_;
-
- DISALLOW_COPY_AND_ASSIGN(ContextHolder);
};
} // namespace gin
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h
index f23af2d9..eaf06bd 100644
--- a/gin/public/isolate_holder.h
+++ b/gin/public/isolate_holder.h
@@ -7,7 +7,6 @@
#include <memory>
-#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "gin/gin_export.h"
#include "gin/public/v8_idle_task_runner.h"
@@ -76,6 +75,8 @@
AllowAtomicsWaitMode atomics_wait_mode,
IsolateType isolate_type,
IsolateCreationMode isolate_creation_mode = IsolateCreationMode::kNormal);
+ IsolateHolder(const IsolateHolder&) = delete;
+ IsolateHolder& operator=(const IsolateHolder&) = delete;
~IsolateHolder();
// Should be invoked once before creating IsolateHolder instances to
@@ -119,8 +120,6 @@
std::unique_ptr<V8IsolateMemoryDumpProvider> isolate_memory_dump_provider_;
AccessMode access_mode_;
IsolateType isolate_type_;
-
- DISALLOW_COPY_AND_ASSIGN(IsolateHolder);
};
} // namespace gin
diff --git a/gin/public/v8_platform.h b/gin/public/v8_platform.h
index da2aeb2..967ef1d 100644
--- a/gin/public/v8_platform.h
+++ b/gin/public/v8_platform.h
@@ -7,7 +7,6 @@
#include "base/compiler_specific.h"
#include "base/lazy_instance.h"
-#include "base/macros.h"
#include "base/partition_alloc_buildflags.h"
#include "gin/gin_export.h"
#include "v8/include/v8-platform.h"
@@ -17,6 +16,9 @@
// A v8::Platform implementation to use with gin.
class GIN_EXPORT V8Platform : public v8::Platform {
public:
+ V8Platform(const V8Platform&) = delete;
+ V8Platform& operator=(const V8Platform&) = delete;
+
static V8Platform* Get();
// v8::Platform implementation.
@@ -51,8 +53,6 @@
class TracingControllerImpl;
std::unique_ptr<TracingControllerImpl> tracing_controller_;
-
- DISALLOW_COPY_AND_ASSIGN(V8Platform);
};
} // namespace gin
diff --git a/gin/runner.h b/gin/runner.h
index 784687d..c860f19 100644
--- a/gin/runner.h
+++ b/gin/runner.h
@@ -7,7 +7,6 @@
#include <string>
-#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "gin/gin_export.h"
#include "gin/public/context_holder.h"
@@ -19,6 +18,8 @@
class GIN_EXPORT Runner {
public:
Runner();
+ Runner(const Runner&) = delete;
+ Runner& operator=(const Runner&) = delete;
virtual ~Runner();
// Before running script in this context, you'll need to enter the runner's
@@ -40,22 +41,20 @@
class GIN_EXPORT Scope {
public:
explicit Scope(Runner* runner);
+ Scope(const Scope&) = delete;
+ Scope& operator=(const Scope&) = delete;
~Scope();
private:
v8::Isolate::Scope isolate_scope_;
v8::HandleScope handle_scope_;
v8::Context::Scope scope_;
-
- DISALLOW_COPY_AND_ASSIGN(Scope);
};
private:
friend class Scope;
base::WeakPtrFactory<Runner> weak_factory_{this};
-
- DISALLOW_COPY_AND_ASSIGN(Runner);
};
} // namespace gin
diff --git a/gin/shell/gin_main.cc b/gin/shell/gin_main.cc
index cdab574..25d8edeb 100644
--- a/gin/shell/gin_main.cc
+++ b/gin/shell/gin_main.cc
@@ -10,7 +10,6 @@
#include "base/i18n/icu_util.h"
#include "base/location.h"
#include "base/logging.h"
-#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
@@ -44,7 +43,9 @@
class GinShellRunnerDelegate : public ShellRunnerDelegate {
public:
- GinShellRunnerDelegate() {}
+ GinShellRunnerDelegate() = default;
+ GinShellRunnerDelegate(const GinShellRunnerDelegate&) = delete;
+ GinShellRunnerDelegate& operator=(const GinShellRunnerDelegate&) = delete;
v8::Local<v8::ObjectTemplate> GetGlobalTemplate(
ShellRunner* runner,
@@ -58,9 +59,6 @@
void UnhandledException(ShellRunner* runner, TryCatch& try_catch) override {
LOG(ERROR) << try_catch.GetStackTrace();
}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(GinShellRunnerDelegate);
};
} // namespace
diff --git a/gin/shell_runner.h b/gin/shell_runner.h
index 10c92df..82d72a3 100644
--- a/gin/shell_runner.h
+++ b/gin/shell_runner.h
@@ -7,7 +7,6 @@
#include <memory>
-#include "base/macros.h"
#include "gin/runner.h"
namespace gin {
@@ -40,6 +39,8 @@
class GIN_EXPORT ShellRunner : public Runner {
public:
ShellRunner(ShellRunnerDelegate* delegate, v8::Isolate* isolate);
+ ShellRunner(const ShellRunner&) = delete;
+ ShellRunner& operator=(const ShellRunner&) = delete;
~ShellRunner() override;
// Before running script in this context, you'll need to enter the runner's
@@ -58,8 +59,6 @@
ShellRunnerDelegate* delegate_;
std::unique_ptr<ContextHolder> context_holder_;
-
- DISALLOW_COPY_AND_ASSIGN(ShellRunner);
};
} // namespace gin
diff --git a/gin/test/v8_test.h b/gin/test/v8_test.h
index 73fdb3a3..660112c 100644
--- a/gin/test/v8_test.h
+++ b/gin/test/v8_test.h
@@ -8,7 +8,6 @@
#include <memory>
#include "base/compiler_specific.h"
-#include "base/macros.h"
#include "base/test/task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "v8/include/v8.h"
@@ -22,6 +21,8 @@
class V8Test : public testing::Test {
public:
V8Test();
+ V8Test(const V8Test&) = delete;
+ V8Test& operator=(const V8Test&) = delete;
~V8Test() override;
void SetUp() override;
@@ -33,9 +34,6 @@
base::test::TaskEnvironment task_environment_;
std::unique_ptr<IsolateHolder> instance_;
v8::Persistent<v8::Context> context_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(V8Test);
};
} // namespace gin
diff --git a/gin/try_catch.h b/gin/try_catch.h
index a1daaf1c..c0e1dea 100644
--- a/gin/try_catch.h
+++ b/gin/try_catch.h
@@ -7,7 +7,6 @@
#include <string>
-#include "base/macros.h"
#include "gin/gin_export.h"
#include "v8/include/v8.h"
@@ -17,6 +16,8 @@
class GIN_EXPORT TryCatch {
public:
explicit TryCatch(v8::Isolate* isolate);
+ TryCatch(const TryCatch&) = delete;
+ TryCatch& operator=(const TryCatch&) = delete;
~TryCatch();
bool HasCaught();
@@ -25,8 +26,6 @@
private:
v8::Isolate* isolate_;
v8::TryCatch try_catch_;
-
- DISALLOW_COPY_AND_ASSIGN(TryCatch);
};
} // namespace gin
diff --git a/gin/v8_foreground_task_runner_with_locker.cc b/gin/v8_foreground_task_runner_with_locker.cc
index 949ed0d..a7e6c4dc 100644
--- a/gin/v8_foreground_task_runner_with_locker.cc
+++ b/gin/v8_foreground_task_runner_with_locker.cc
@@ -32,7 +32,8 @@
public:
IdleTaskWithLocker(v8::Isolate* isolate, std::unique_ptr<v8::IdleTask> task)
: isolate_(isolate), task_(std::move(task)) {}
-
+ IdleTaskWithLocker(const IdleTaskWithLocker&) = delete;
+ IdleTaskWithLocker& operator=(const IdleTaskWithLocker&) = delete;
~IdleTaskWithLocker() override = default;
// v8::IdleTask implementation.
@@ -44,8 +45,6 @@
private:
v8::Isolate* isolate_;
std::unique_ptr<v8::IdleTask> task_;
-
- DISALLOW_COPY_AND_ASSIGN(IdleTaskWithLocker);
};
} // namespace
diff --git a/gin/v8_isolate_memory_dump_provider.h b/gin/v8_isolate_memory_dump_provider.h
index b53d2a8..44bdba9c 100644
--- a/gin/v8_isolate_memory_dump_provider.h
+++ b/gin/v8_isolate_memory_dump_provider.h
@@ -7,7 +7,6 @@
#include <string>
-#include "base/macros.h"
#include "base/single_thread_task_runner.h"
#include "base/trace_event/memory_dump_provider.h"
#include "gin/gin_export.h"
@@ -24,6 +23,9 @@
V8IsolateMemoryDumpProvider(
IsolateHolder* isolate_holder,
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+ V8IsolateMemoryDumpProvider(const V8IsolateMemoryDumpProvider&) = delete;
+ V8IsolateMemoryDumpProvider& operator=(const V8IsolateMemoryDumpProvider&) =
+ delete;
~V8IsolateMemoryDumpProvider() override;
// MemoryDumpProvider implementation.
@@ -37,8 +39,6 @@
base::trace_event::ProcessMemoryDump* process_memory_dump);
IsolateHolder* isolate_holder_; // Not owned.
-
- DISALLOW_COPY_AND_ASSIGN(V8IsolateMemoryDumpProvider);
};
} // namespace gin
diff --git a/gin/v8_platform.cc b/gin/v8_platform.cc
index 3833b0e3..60f38b2d 100644
--- a/gin/v8_platform.cc
+++ b/gin/v8_platform.cc
@@ -53,6 +53,10 @@
explicit ConvertableToTraceFormatWrapper(
std::unique_ptr<v8::ConvertableToTraceFormat> inner)
: inner_(std::move(inner)) {}
+ ConvertableToTraceFormatWrapper(const ConvertableToTraceFormatWrapper&) =
+ delete;
+ ConvertableToTraceFormatWrapper& operator=(
+ const ConvertableToTraceFormatWrapper&) = delete;
~ConvertableToTraceFormatWrapper() override = default;
void AppendAsTraceFormat(std::string* out) const final {
inner_->AppendAsTraceFormat(out);
@@ -60,8 +64,6 @@
private:
std::unique_ptr<v8::ConvertableToTraceFormat> inner_;
-
- DISALLOW_COPY_AND_ASSIGN(ConvertableToTraceFormatWrapper);
};
class EnabledStateObserverImpl final
@@ -71,6 +73,10 @@
base::trace_event::TraceLog::GetInstance()->AddEnabledStateObserver(this);
}
+ EnabledStateObserverImpl(const EnabledStateObserverImpl&) = delete;
+
+ EnabledStateObserverImpl& operator=(const EnabledStateObserverImpl&) = delete;
+
~EnabledStateObserverImpl() override {
base::trace_event::TraceLog::GetInstance()->RemoveEnabledStateObserver(
this);
@@ -111,8 +117,6 @@
private:
base::Lock mutex_;
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
-
- DISALLOW_COPY_AND_ASSIGN(EnabledStateObserverImpl);
};
base::LazyInstance<EnabledStateObserverImpl>::Leaky g_trace_state_dispatcher =
@@ -130,6 +134,8 @@
#endif
TimeClamper() : secret_(base::RandUint64()) {}
+ TimeClamper(const TimeClamper&) = delete;
+ TimeClamper& operator=(const TimeClamper&) = delete;
double ClampTimeResolution(double time_seconds) const {
bool was_negative = false;
@@ -175,7 +181,6 @@
}
const uint64_t secret_;
- DISALLOW_COPY_AND_ASSIGN(TimeClamper);
};
base::LazyInstance<TimeClamper>::Leaky g_time_clamper =
@@ -366,6 +371,8 @@
class V8Platform::TracingControllerImpl : public v8::TracingController {
public:
TracingControllerImpl() = default;
+ TracingControllerImpl(const TracingControllerImpl&) = delete;
+ TracingControllerImpl& operator=(const TracingControllerImpl&) = delete;
~TracingControllerImpl() override = default;
// TracingController implementation.
@@ -444,9 +451,6 @@
void RemoveTraceStateObserver(TraceStateObserver* observer) override {
g_trace_state_dispatcher.Get().RemoveObserver(observer);
}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl);
};
// static
diff --git a/gin/v8_shared_memory_dump_provider.h b/gin/v8_shared_memory_dump_provider.h
index da6eaaa..fb66f0b 100644
--- a/gin/v8_shared_memory_dump_provider.h
+++ b/gin/v8_shared_memory_dump_provider.h
@@ -7,7 +7,6 @@
#include <string>
-#include "base/macros.h"
#include "base/trace_event/memory_dump_provider.h"
#include "gin/gin_export.h"
@@ -20,6 +19,9 @@
: public base::trace_event::MemoryDumpProvider {
public:
V8SharedMemoryDumpProvider();
+ V8SharedMemoryDumpProvider(const V8SharedMemoryDumpProvider&) = delete;
+ V8SharedMemoryDumpProvider& operator=(const V8SharedMemoryDumpProvider&) =
+ delete;
// MemoryDumpProvider implementation.
bool OnMemoryDump(
@@ -27,9 +29,6 @@
base::trace_event::ProcessMemoryDump* process_memory_dump) override;
static void Register();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(V8SharedMemoryDumpProvider);
};
} // namespace gin
diff --git a/gin/wrappable.h b/gin/wrappable.h
index f9b7b93..838eec06 100644
--- a/gin/wrappable.h
+++ b/gin/wrappable.h
@@ -7,7 +7,6 @@
#include <type_traits>
-#include "base/macros.h"
#include "gin/converter.h"
#include "gin/gin_export.h"
#include "gin/public/wrapper_info.h"
@@ -63,6 +62,10 @@
// Non-template base class to share code between templates instances.
class GIN_EXPORT WrappableBase {
+ public:
+ WrappableBase(const WrappableBase&) = delete;
+ WrappableBase& operator=(const WrappableBase&) = delete;
+
protected:
WrappableBase();
virtual ~WrappableBase();
@@ -85,25 +88,23 @@
bool dead_ = false;
v8::Global<v8::Object> wrapper_; // Weak
-
- DISALLOW_COPY_AND_ASSIGN(WrappableBase);
};
template<typename T>
class Wrappable : public WrappableBase {
public:
- // Retrieve (or create) the v8 wrapper object cooresponding to this object.
+ Wrappable(const Wrappable&) = delete;
+ Wrappable& operator=(const Wrappable&) = delete;
+
+ // Retrieve (or create) the v8 wrapper object corresponding to this object.
v8::MaybeLocal<v8::Object> GetWrapper(v8::Isolate* isolate) {
return GetWrapperImpl(isolate, &T::kWrapperInfo);
}
protected:
- Wrappable() {}
- ~Wrappable() override {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Wrappable);
+ Wrappable() = default;
+ ~Wrappable() override = default;
};
template <typename T>
diff --git a/gin/wrappable_unittest.cc b/gin/wrappable_unittest.cc
index 93ae0eaa..c26e8ce 100644
--- a/gin/wrappable_unittest.cc
+++ b/gin/wrappable_unittest.cc
@@ -3,8 +3,8 @@
// found in the LICENSE file.
#include "gin/wrappable.h"
+
#include "base/check.h"
-#include "base/macros.h"
#include "gin/arguments.h"
#include "gin/handle.h"
#include "gin/object_template_builder.h"
@@ -27,6 +27,8 @@
class BaseClass {
public:
BaseClass() : value_(23) {}
+ BaseClass(const BaseClass&) = delete;
+ BaseClass& operator=(const BaseClass&) = delete;
virtual ~BaseClass() = default;
// So the compiler doesn't complain that |value_| is unused.
@@ -34,13 +36,14 @@
private:
int value_;
-
- DISALLOW_COPY_AND_ASSIGN(BaseClass);
};
class MyObject : public BaseClass,
public Wrappable<MyObject> {
public:
+ MyObject(const MyObject&) = delete;
+ MyObject& operator=(const MyObject&) = delete;
+
static WrapperInfo kWrapperInfo;
static gin::Handle<MyObject> Create(v8::Isolate* isolate) {
@@ -64,8 +67,6 @@
private:
int value_;
-
- DISALLOW_COPY_AND_ASSIGN(MyObject);
};
class MyObject2 : public Wrappable<MyObject2> {
@@ -75,6 +76,9 @@
class MyNamedObject : public Wrappable<MyNamedObject> {
public:
+ MyNamedObject(const MyNamedObject&) = delete;
+ MyNamedObject& operator=(const MyNamedObject&) = delete;
+
static WrapperInfo kWrapperInfo;
static gin::Handle<MyNamedObject> Create(v8::Isolate* isolate) {
@@ -92,9 +96,6 @@
}
const char* GetTypeName() final { return "MyNamedObject"; }
~MyNamedObject() override = default;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MyNamedObject);
};
WrapperInfo MyObject::kWrapperInfo = { kEmbedderNativeGin };
@@ -294,6 +295,10 @@
class MyObjectWithLazyProperties
: public Wrappable<MyObjectWithLazyProperties> {
public:
+ MyObjectWithLazyProperties(const MyObjectWithLazyProperties&) = delete;
+ MyObjectWithLazyProperties& operator=(const MyObjectWithLazyProperties&) =
+ delete;
+
static WrapperInfo kWrapperInfo;
static gin::Handle<MyObjectWithLazyProperties> Create(v8::Isolate* isolate) {
@@ -322,7 +327,6 @@
}
int access_count_ = 0;
- DISALLOW_COPY_AND_ASSIGN(MyObjectWithLazyProperties);
};
WrapperInfo MyObjectWithLazyProperties::kWrapperInfo = {kEmbedderNativeGin};