chore: enable check raw ptr fields (#38167)

This commit is contained in:
John Kleinschmidt 2023-05-11 16:07:39 -04:00 committed by GitHub
parent 141175c723
commit 3dbc0a365f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
120 changed files with 298 additions and 185 deletions

View file

@ -5,6 +5,8 @@
#ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_ACCESSOR_H_
#define ELECTRON_SHELL_COMMON_GIN_HELPER_ACCESSOR_H_
#include "base/memory/raw_ptr_exclusion.h"
namespace gin_helper {
// Wrapper for a generic value to be used as an accessor in a
@ -19,7 +21,7 @@ struct AccessorValue<const T&> {
};
template <typename T>
struct AccessorValue<const T*> {
T* Value;
RAW_PTR_EXCLUSION T* Value;
};
} // namespace gin_helper

View file

@ -5,6 +5,7 @@
#ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_ERROR_THROWER_H_
#define ELECTRON_SHELL_COMMON_GIN_HELPER_ERROR_THROWER_H_
#include "base/memory/raw_ptr.h"
#include "base/strings/string_piece.h"
#include "v8/include/v8.h"
@ -29,7 +30,7 @@ class ErrorThrower {
v8::Local<v8::Value> (*)(v8::Local<v8::String> err_msg);
void Throw(ErrorGenerator gen, base::StringPiece err_msg) const;
v8::Isolate* isolate_;
raw_ptr<v8::Isolate> isolate_;
};
} // namespace gin_helper

View file

@ -9,6 +9,7 @@
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "gin/arguments.h"
#include "shell/common/gin_helper/arguments.h"
#include "shell/common/gin_helper/destroyable.h"
@ -241,7 +242,7 @@ class Invoker<IndicesHolder<indices...>, ArgTypes...>
return arg1 && And(args...);
}
gin::Arguments* args_;
raw_ptr<gin::Arguments> args_;
};
// DispatchToCallback converts all the JavaScript arguments to C++ types and

View file

@ -5,6 +5,7 @@
#ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_OBJECT_TEMPLATE_BUILDER_H_
#define ELECTRON_SHELL_COMMON_GIN_HELPER_OBJECT_TEMPLATE_BUILDER_H_
#include "base/memory/raw_ptr.h"
#include "shell/common/gin_helper/function_template.h"
namespace gin_helper {
@ -66,7 +67,7 @@ class ObjectTemplateBuilder {
v8::Local<v8::FunctionTemplate> getter,
v8::Local<v8::FunctionTemplate> setter);
v8::Isolate* isolate_;
raw_ptr<v8::Isolate> isolate_;
// ObjectTemplateBuilder should only be used on the stack.
v8::Local<v8::ObjectTemplate> template_;

View file

@ -5,6 +5,7 @@
#ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_PERSISTENT_DICTIONARY_H_
#define ELECTRON_SHELL_COMMON_GIN_HELPER_PERSISTENT_DICTIONARY_H_
#include "base/memory/raw_ptr.h"
#include "shell/common/gin_helper/dictionary.h"
namespace gin_helper {
@ -38,7 +39,7 @@ class PersistentDictionary {
}
private:
v8::Isolate* isolate_ = nullptr;
raw_ptr<v8::Isolate> isolate_ = nullptr;
v8::Global<v8::Object> handle_;
};

View file

@ -10,6 +10,7 @@
#include <type_traits>
#include <utility>
#include "base/memory/raw_ptr.h"
#include "base/strings/string_piece.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
@ -77,7 +78,7 @@ class PromiseBase {
v8::Local<v8::Promise::Resolver> GetInner() const;
private:
v8::Isolate* isolate_;
raw_ptr<v8::Isolate> isolate_;
v8::Global<v8::Context> context_;
v8::Global<v8::Promise::Resolver> resolver_;
};

View file

@ -5,6 +5,7 @@
#ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_WRAPPABLE_BASE_H_
#define ELECTRON_SHELL_COMMON_GIN_HELPER_WRAPPABLE_BASE_H_
#include "base/memory/raw_ptr.h"
#include "v8/include/v8.h"
namespace gin {
@ -62,7 +63,7 @@ class WrappableBase {
static void SecondWeakCallback(
const v8::WeakCallbackInfo<WrappableBase>& data);
v8::Isolate* isolate_ = nullptr;
raw_ptr<v8::Isolate> isolate_ = nullptr;
};
} // namespace gin_helper